
                   TPanelButton, TGlyphControl  components 
                   ---------------------------------------
       
                             Delphi 3, 4, 5 
         
                       *************************
                       *  All rights reserved  *
                       *************************
                  

1.     TPanelButton (improved + full source code )

                  <<< Build as a PANEL, Use as a BUTTON >>>

1.1    TPanelButton Overview  

  TPanelButton is a button which can have multiple controls on it. 
  
  It maintains similar functionality to TButton. The main difference is
  that Controls (labels, Images, Panels, Groupboxes, GlyphControls etc.) can be 
  dropped onto the TPanelButton at design time.
  
  At design time you can 'design' the  PanelButton exactly as you do it with 
  a Panel or GroupBox - drag and drop controls on.

  At run time the TPanelButton has the same behavior as TButton (with raised 
  and lowered visual effects). All controls will move along with the face of 
  the TPanelButton just as a TButton's Caption does.

  Click and Mouse events of TPanelButton work when mouse is over TPanelButton
  or any child control. Click and Mouse events of child controls work as well
  if assigned at design time.

    In addition, TPanelButton has a Color property which allows creation 
  of different (from standard Windows) interface - for example blue Form 
  with blue PanelButtons. Also TPanelButton has Stuck property enabling more
  raised drawing effect at run time - when mouse is moving over the TPanelButton.


1.2    Properties and methods.

  TPanelButton is a descendant of TButton and inherits all corresponding
  properties and methods. In addition it has following properties:
        Color: TColor ;
        Bevel Width: Integer;
        AccelText: TCaption;
        Stuck: Boolean;
  and method:
        UnStick;

   TPanelButton has caption, but it is blank initially. You can choose not 
  to use the caption, but drop label(s) instead. In this  case you need to
  explicitly set the accelerator key using the AccelText property. In Object
  Inspector you can select the AccelText string via a drop-down displaying 
  the captions of the labels already dropped onto the TPanelButton.
  Corresponding Property Editor is included.

   Property Stuck enables the visual effect of 'sticking' TPanelButton
  at run time -more raised drawing when mouse is moving over the PanelButton.
  TPanelButton does not affect its parent OnMouseMove event. In other words 
  TPanelButton can't 'unstick' itself (on component level) when cursor is 
  outside of TPanelButton area. PanelButton has the method  'Unstick' to 
  handle this case. This method should be called in procedure  linked to 
  parent OnMouseMove event. For example:
    Project has Form1 where PanelButton1 is dropped.
    PanelButton1.stuck property is set to true to activate the effect.
    Form1MouseMove event handler has the code: PanelButton1.UnStick
    to 'unstick' the PanelButton1 when the cursor has left PanelButton1.

1.3   Component design Notices.

  TPanelButton is a descendant of TButton. TButton has Controls property
  as TWinControl descendant but does not have a canvas and has the default 
  method of drawing. So Canvas and Paint related methods of TCustomControl 
  Class were added, the color property was published, and the Bevel Width
  property added. The Protected Paint method draws the button (up or down)
  on the canvas.  Another part of the design (more complex to explain but
  fun to do) was managing Click and Mouse event handlers for all child 
  controls. I've designed DoClick, DoMouseUp, DoMouseDown, DoMouseMove
  procedures  which handle visual moving Up and Down  for all the controls
  inside of TPanelButton. To handle original event handlers of child controls
  special class TDEventRecorder was designed. Detail materials (with source)
  are published separately.

1.3 Limitations
  There is one limitation I'd like to mention. You can not use Sender parameter
in event handlers of TPanelButton to access the TPanelButton. The reason is internal TImage 
I'm using in TPanelButton to reduce flickering.

Instead of using:  Sender as TPanelButton
You can use:       (sender as TControl).parent as TPanelButton

1.4 Improvements (comparing to previously uploaded in PanBut32.zip)

  The functionality is improved here. Panel Button can handle properly 
  not only Graphic controls  but other descendants of  TWinControl - 
  panels, groupboxes, etc.    


2      TGlyphControl

  2.1    TGlyphControl  Overview.

  TGlyphControl is a TGraphicControl which can set different images from 
  glyph - for Enabled and Disabled states. You can drop TGlyphControl object
  on any form: Panel, TPanelButton etc., load glyph from  Delphi/images/buttons/,
  and set Enabled or Disabled state.  Actual image will be changed exactly
  as it is changed on BitButton.

  2.2    TGlyphControl Properties and methods.

  TGlyphControl Component is very simple. It is a descendant of TGraphicControl
  and has corresponding properties and methods.In addition it has Glyph and
  Enabled properties and Click and Mouse Events.

  2.3    TGlyphControl Component design Notices.

  TGlyphControl Component is actually 'extracted' from TBitButton 
  (Buttons unit, VCL) It is using  TButtonGlyph, TGlyphCache and TBitPool
  classes from VCL. Because of the VCL design (declarations in Implementation
  section of Button unit) they were copied from the VCL to the unit.


3. Files included:
  
   PanButS.zip includes following files:
  

   PanelButton.dcr      PanelButton Palette Image;
   GlypthControl.dcr    GlypthControl Palette Image


   PanelButton.pas      Source Code unit for TPanelButton component
   GlypthControl.pas    Source Code unit for TGlypthControl component.

   Project1.dpr         Demo 1 Project 
   Unit1.dfm
   Unit1.pas
 	   
   Project1.dpr         Demo 2 Project 'Cute Buttons'
   Unit1.dfm
   Unit1.pas
 	   
   ReadMe.txt


5. Installation:
   
    You can install components into  existing/new package:
      Go Component/Install Component, Browse unit file name to your folder,
      Select existing or new package page.
      Select pas file type and then PanelButton.pas, GlypthControl.pas files,
      Select package or put new package name,
      For new package:
         Click OK on adding VCLDB30.
   

 Developed by Galina Tydykov (Boston, USA, tydykov@sonamed.com, ValeryGalina@Mediaone.net).

 Published by permission of SonaMed Corp.

 This software is provided "AS IS," without a warranty of any kind. ALL
 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING 
 * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 
 * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SONAMED SHALL NOT BE LIABLE FOR
 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
 * DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SONAMED
 * BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,INDIRECT,
 * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED  
 * AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
 * OR INABILITY TO USE SOFTWARE, EVEN IF SONAMED HAS BEEN ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES.
 *

