IndicatorColumn
TDataGridEh.IndicatorColumn
property IndicatorColumn: TDataGridIndicatorColumnEh;published
Use this property to customize the first indicator column in the grid.
TDataGridEh.IndicatorColumn Properties
The IndicatorColumn property is of type TDataGridIndicatorColumnEh and contains the following subproperties:
IndicatorColumn.HorzLinesColor
property HorzLinesColor: TAlphaColor;Sets the color of the horizontal dividing lines in the indicator section.
IndicatorColumn.HorzLinesVisible
property HorzLinesVisible: Boolean;Sets the visibility of horizontal dividing lines in the indicator section.
IndicatorColumn.RecNoShowStep
property RecNoShowStep: Integer default 10;Specifies the number of skipped records after which the record number is drawn in the indicator cell. In skipped records, a short dash is drawn instead of the record number.
IndicatorColumn.ShowEditIndicator
property ShowEditIndicator: Boolean;Determines whether to draw the current record icon, edit icon, and insert new record icon.
IndicatorColumn.ShowRecNo
property ShowRecNo: Boolean;Determines whether to draw the section with the record number.
IndicatorColumn.VertLinesColor
property VertLinesColor: TAlphaColor;Sets the color of the vertical dividing lines in the indicator section.
IndicatorColumn.VertLinesVisible
property VertLinesVisible: Boolean;Sets the visibility of vertical dividing lines in the indicator section.
IndicatorColumn.Visible
property Visible: Boolean;Sets the visibility of the indicator column in the grid.
TDataGridEh.IndicatorColumn Events
IndicatorColumn.OnCalcColumnWidth
property OnCalcColumnWidth: TDataGridIndicatorColumnCalcColumnWidthEventEh;TDataGridIndicatorColumnCalcColumnWidthEventEh = procedure(
Sender: TObject;
Params: TDataGridCalcIndicatorCalcColumnWidthParamsEh) of object;The event is called when IndicatorColumn recalculates its width. Usually, the width of the last, i.e. widest, cell of the indicator is calculated to calculate the width. You can recalculate the width using your own algorithm or call the default calculation method Params.DefaultCalcColumnWidth().
The following example assumes that the indicator cell uses non-standard content and to correctly fill the cell content in the cell width calculation mode, the FIndicatorCalcMode field is set to True.
In the OnCellInitContent event handlers, you must use this field to correctly fill the cell content to calculate its maximum possible width.
procedure TFormTest1.DataGridEh1IndicatorColumnCalcColumnWidth(Sender: TObject;
Params: TDataGridCalcIndicatorCalcColumnWidthParamsEh);
begin
FIndicatorCalcMode := True;
Params.Width := Params.DefaultCalcColumnWidth();
Params.Handled := True;
FIndicatorCalcMode := False;
end;IndicatorColumn.OnCellInitContent
property OnCellInitContent: TDataGridIndicatorColumnInitCellContentEventEh; TDataGridIndicatorColumnInitCellContentEventEh = procedure(
Sender: TObject;
Params: TDataGridIndicatorColumnInitCellContentParamsEh) of object;The event is called when it is necessary to fill the contents of the indicator cell based on the currently rendered grid row.
procedure TFormTest1.DataGridEh1IndicatorColumnCellInitContent(Sender: TObject;
Params: TDataGridIndicatorColumnInitCellContentParamsEh);
begin
if FIndicatorCalcMode then
TLaTextBlockEh(Params.CellContent).Text := ' Cur '
else if Params.Row = TDataGridEh(Params.Grid).CurrentRow then
TLaTextBlockEh(Params.CellContent).Text := 'Cur'
else
TLaTextBlockEh(Params.CellContent).Text := '';
Params.Handled := True;
end;IndicatorColumn.OnCreateCellContent
property OnCreateCellContent: TDataGridIndicatorColumnCreateCellContentEventEh;TDataGridIndicatorColumnCreateCellContentEventEh = procedure(
Sender: TObject;
Params: TDataGridIndicatorColumnCreateCellContentParamsEh) of object;The event is called by the CellManager asking for code to create the cell content. If the handler is left empty, the default content will be created. For IndicatorColumn, the content consists of the record number and the current record indicator.
procedure TFormTest1.DataGridEh1IndicatorColumnCreateCellContent(Sender: TObject;
Params: TDataGridIndicatorColumnCreateCellContentParamsEh);
begin
with TLaTextBlockEh.CreateWith(Params.ContentParent, Params.ContentParent) do
begin
Params.CellContent := RefSelf;
Text := 'Test';
TextAlign := TTextAlign.Center;
end;
end;IndicatorColumn.OnGetCellManager
property OnGetCellManager: TDataGridIndicatorColumnGetCellManagerEventEh;TDataGridIndicatorColumnGetCellManagerEventEh = procedure(
Sender: TObject;
Params: TDataGridIndicatorColumnGetCellManagerParamsEh) of object;The event is called for each rendering operation in the grid in the grid section - IndicatorColumn.
The event is called for each cell.
In the event, you can specify a new CellManager object that will be responsible for creating the grid cell object and managing the grid cell object.
If the Params.CellManager property is not assigned in the event handler, the default CellManager TDataGridEh.IndicatorColumn.DefaultCellManager will be used.
Read more in the CellManagers section.
procedure TFormTest1.DataGridEh1IndicatorColumnGetCellManager(
Sender: TObject;
Params: TDataGridIndicatorColumnGetCellManagerParamsEh);
var
Val: TValue;
begin
Val := ColOrderNo.GetRowValue(Params.Row);
if SameValue(Val, 207) then
begin
Params.CellManager := MyIndicatorColumnCellManage;
end;
end;