Skip to main content

TcxCustomGridTableView.OnPopulateCustomScrollbarAnnotationRowIndexList Event

Enables you to display custom scrollbar annotations.

Declaration

property OnPopulateCustomScrollbarAnnotationRowIndexList: TcxGridPopulateCustomScrollbarAnnotationRowIndexList read; write;

Remarks

This event occurs every time the grid View starts to populate its scrollbar with marks of a custom scrollbar annotation. Call the ScrollbarAnnotations.CustomAnnotations.Add function and handle the OnPopulateCustomScrollbarAnnotationRowIndexList event to display custom annotation marks on a scrollbar. An event handler must check annotation mark display conditions. For instance, the following code example marks all rows that list cars with two doors:

procedure TMyForm.cxGrid1DBTableView1PopulateCustomScrollbarAnnotationRowIndexList(Sender: TcxCustomGridTableView; AAnnotationIndex: Integer; ARowIndexList: TdxScrollbarAnnotationRowIndexList);
var
  I: Integer;
  AValue: Variant;
begin
  for I := 0 to cxGrid1DBTableView1.ViewData.RecordCount - 1 do  // Iterates through all records
  begin
    if cxGrid1DBTableView1.ViewData.Records[I].IsData then  // If the current record is not empty
      AValue := cxGrid1DBTableView1.ViewData.Records[I].Values[clDoorCount.Index];  // Obtains the clDoorCount field value for the record
    else
      AValue := Null;
    if (not VarIsNull(AValue) and (Value = 2)) then  // If the clDoorCount field value is 2
      ARowIndexList.Add(I);  // Adds the current record index to the list of marked records
  end;
end;

Refer to the TcxGridPopulateCustomScrollbarAnnotationRowIndexList procedural type description for detailed information on parameters accessible within an OnPopulateCustomScrollbarAnnotationRowIndexList event handler.

Note

The OnPopulateCustomScrollbarAnnotationRowIndexList event does not occur if scrollbar annotations are disabled or the grid View has no custom annotations.

See Also