EhLib
ContentsIndexHome
PreviousUpNext
Customizing grid title

Use the sub-properties of property TDBGridEh.TitleParams to adjust display the column grid. 

Sub-properties of property TDBGridEh.TitleParams:

Property name 
Property type 
Description 
Color 
TColor 
Specifies the background color for the title cells. 
Font 
TFont 
Controls the font in which the title cells displays its data. 
ParentFont 
Boolean 
Determines where a control looks for its font information. 
SecondColor 
TColor 
Second background color that is used when cells painted in gradient mode. Use FillStyle property to define paint style. 
Images 
TCustomImageList 
List of Images when displaying images in the header. Index of drawing Image is defined in Column.Title.ImageIndex. 
MultiTitle 
Boolean 
Determines that the title will be drawn in a MultiTitle mode. 
RowHeight 
Integer 
Specifies the height of data row in pixels. 
RowLines 
Integer 
Specifies the height of data row in text lines.
Full row height = height in pixels of RowLines + RowHeight. 
SortMarkerStyle 
TSortMarkerStyleEh 
Defines the shape of the sorting markers. 
VTitleMargin 
Integer 
Specifies the margin between text and bottom of title; and margin between text and top of title. 
VertLineColor 
TColor 
Color vertical lines in the data area. 
VertLines 
Boolean 
Presence of vertical lines in the data area. 
HorzLineColor 
TColor 
Color of the horizontal lines in the data area. 
HorzLines 
Boolean 
Presence of horizontal lines in the data area. 
FillStyle 
TGridCellFillStyleEh 
Specifies the style of filling the title cells. 
BorderInFillStyle 
Boolean 
Specifies that the vertical lines are drawn by the function that draw header cell rather then function that draw cell lines. In this mode vertical lines are drawn not to the end of the border crossing. 

Complex titles. 

TDBGridEh allows to create one common title above several columns. See Figure: 

To do it, set DBGridEh.UseMultiTitle property to True value and fill label of the fields or caption of column title using next rule: every part of text in field label or column title must consist of several parts divided by sign "|", where every common part must be same for several required columns. Other fields or captions must contain same text in the corresponding parts. 

For example:

Field1.DisplayLabel := 'Title1|SubTitle1';
Field2.DisplayLabel := 'Title1|SubTitle2';

or

DBGridEh.Columns[0].Title.Caption := 'Title1|SubTitle1';
DBGridEh.Columns[1].Title.Caption := 'Title1|SubTitle2';

 

Title acts as a button. 

 

Set Column.Title.TitleButton to True to make title cells act as a button. You can also write an OnTitleBtnClick event to take specific action when the user clicks on title cell. 

 

Show bitmaps in titles. 

 

Use TitleImages property of TDBGridEh and ImageIndex property of TColumnTitleEh to show bitmap in titles instead of caption. 

 

Default values for title properties. 

 

Use TDBGridEh.ColumnDefValues.Title property to set default values for title properties. 

 

Sorting markers 

 

Change the sort order for the marker sorting. In the new version make the p-triangle sorting pointing down means sorting type DESC (from highest to lowest). The first sort direction is determined by the type of field. For text fields, the first sort order is set to high for the rest of the fields in descending order. To change the direction of the first rewrite virtual function use TDBGridEhCenter.GetFirstSortMarkerState. To install the new center Grids use the global function SetDBGridEhCenter. 

You can set the icon sorting through properties TDBGridEh.TitleParams. SortMarkerStyle for a particular grid or through global property DBGridEhDefaultStyle.SortMarkerStyle. 

type TSortMarkerStyleEh:  

smstDefaultEh 
Use steel default defined in DBGridEhDefaultStyle.SortMarkerStyle 
smstClassicEh 
 
smst3DFrameEh 
 
smstFrameEh 
 
smstSolidEh 
 
smstThemeDefinedEh 
 
Copyright (c) 1998-2013. All rights reserved.
What do you think about this topic? Send feedback!