TDBGridEH 1.01

Tested under Delphi 3,4.

TDBGridEH is a TDBGrid like component.
Include all propertis of TDBGrid +
  Allow to create title on several columns (multititle mode) or on the whole
   grid.
  Allow to show a fotter row(s). Opportune to use in combination
   with TDBSumList.
  Allow automatically fit columns width to set grid width equal client width
  Allow change row height and title height
  Allow automatically broken a long lines between words in title and data rows
  Title can act as buttons and show sort marker
  Allow truncate long text by ellipsis
  Lookup list can show several fields
  Frozen columns


  New propertys and events in TDBGridEH                                       
  property TitleHeight: Integer;                                              
      // For simple title mode the height of title in pixels                  
  property TitleLines : Integer;                                              
      // For simple title mode the hieght of title in text lines              
      // Full title height = height in pixels of TitleLines + TitleHeight     
  property UseMultiTitle: Boolean;                                            
      // Set UseMultiTitle in True to create title(s) on several columns      
  property VTitleMargin: Boolean;                                             
      // Margin between text and bottom of title; and margin between          
      // text and top of title                                                
  propery FooterRowCount: Integer;                                            
      // Count Rows of Footer
  property AutoFitColWidths: Boolean;
      // Automatically fit columns width to set grid width equal client width
  property MinAutoFitWidth: Integer;
      // Minimum width for which recalculate columns width.
      // Work if AutoFitColWidths = True.                                     
  property RowsHeight: Integer;                                               
      // Height of data row in pixels                                         
  property RowLines: Integer;
      // Height of data row in text lines
      // Full row height = height in pixels of RowLines + RowsHeight
  property RowSizingAllowed: Boolean;
     // Allow to sizing row at design and ran time
  property DrawMemoText:Boolean;
     // Draw text in memo fields as string
  property FrozenCols: Integer;
     // Count of nonscrolling columns (but no sizing and no take focus too)

  event OnDrawFotterCell: TDrawFooterCellEvent;
  TDrawFooterCellEvent = procedure (Sender: TObject; DataCol, Row: Longint;
    Column: TColumnEH; Rect: TRect; State: TGridDrawState) of object;
       // Customized drawing for footer cell
  event OnCheckButton: TCheckTitleEHBtnEvent;
  TCheckTitleEHBtnEvent = procedure (Sender: TObject; ACol: Longint;
      Field: TField; var Enabled: Boolean) of object;
       // Enable or disable use title as button
  event OnGetBtnParams: TGetBtnEHParamsEvent;
  TGetBtnEHParamsEvent = procedure (Sender:TObject; Field:TField; AFont:TFont;
       var Background: TColor; IsDown: Boolean) of object;
       // If title button pressed you can change drawing Font and Background
  event OnTitleBtnClick: TTitleEHClickEvent;
  TTitleEHClickEvent = procedure (Sender:TObject; ACol:Longint; Field: TField)
     of object;
       // Event occurs when clicking on title button
  event OnGetCellParams: TGetCellEHParamsEvent;
  TGetCellEHParamsEvent = procedure (Sender: TObject; Column: TColumnEH;
    AFont: TFont; var Background: TColor; State: TGridDrawState) of object;
       // Event occurs before draw data cell. You can change draw font and
       // background color

  event OnMouseDown;
  event OnMouseMove;
  event OnMouseUp;

  procedure SaveColumnsLayout(ARegIni: TRegIniFIle);                          
      // Save Columns Order, Width, SortMarker in registry                    
  procedure RestoreColumnsLayout(ARegIni: TRegIniFIle;                        
                 RestoreParams:TColumnEhRestoreParams);                       
  TColumnEhRestoreParam = (crpColIndexEh,crpColWidthsEh,crpSortMarkerEh);     
  TColumnEhRestoreParams = set of TColumnEhRestoreParam;                      
      // Restore Columns Order , Width , SortMarker from registry             
      // RestoreParams defines parameters of column it is necessary to restore


  New propertys in TColumnEH
  property  AutoFitColWidth: Boolean ;
       // Automatically fit column width to set grid width equal client width
  property  WordWrap: Boolean ;
       // Wrap words in data cells if row height > one text line
  property EndEllipsis: Boolean;
       // Truncate long text by ellipsis
  property  DropDownWidth: Integer;
        // Width of DropDown List
        //  > 0  - Width = DropDownWidth
        //   0   - Width = ColumnWidth
        //  -1   - Widht is calculated automatically as sum of
                  fields.DisplayWidth in LookupDisplayFields * TextWidth('0')
  property  LookupDisplayFields: String;
        // Fields is displayed in lookup list
  property  AutoDropDown: Boolean;
        //  Automatically DropDown List on key press
  property  AlwaysShowEditButton: Boolean;
         // Always Show Edit Button


  New propertys in TColumnTitleEH
  property TitleButton: Boolean;
      // If true, the title will act as a button.
  property SortMarker: TSortMarkerEH;
  TSortMarkerEH = (smNoneEh, smDownEh, smUpEh);
     //  Type of sorting marker that will show in right part of title
  property EndEllipsis: Boolean;
     // Truncate long text by ellipsis


Restrictions and particularities of functioning.

To create title on several columns, DisplayLabel of field must
consist of several parts divided by sign "|", where every part
is common part for several columns. Other field must   contain
same text in corresponding parts.
For instance:
    Field1.DisplayLabel := 'Title1|SubTitle1';
    Field2.DisplayLabel := 'Title1|SubTitle2';

In row select mode the button left and right force to next and
prev column
In row multiselect mode the right mouse button over selected row don't
delete selection
Next properties moved in public section
    property Canvas;
    property Col;
    property InplaceEditor;
    property LeftCol;
    property Row;
    property VisibleRowCount;
    property VisibleColCount;
    property IndicatorOffset: Byte read FIndicatorOffset;
    property TitleOffset: Byte read FTitleOffset;
Don't create title on several columns if master title lay in frozen and
nonfrozen zone simultaneously
If AlwaysShowEditButton = True or dgAlwaysShowEditor in Options then
edit button will be pressed on first mouse click
Inplace editor Color and Font take from cell. Cell Color and Font
form from Column Color and Font, and OnGetCellParams event.
In lookup inplace editor you can clear Lookupkeyfield. You need
select text and press Del.


INSTALLATION
Open menu "Component\Install Component...". In "Unit file name" browse
GridEhRe.pas. In "Package file name" browse LIB\dclusr30.dpk
(LIB\dclusr40.dpk × Delphi 4). Click Ok


Contact me if you have any questions, comments or suggestions:
Programmer: Dmitry V. Bolshakov
(4232)41-19-82 (voice in Russia)
E-mail: dmitryb@tax25.marine.su
Home page http://tax25.marine.su/dmitryb
FidoNet 2:5045/41.63
QCI # 10785451