TAdvStringGrid
Example 86 : Using the TAdvGridLookupBar
![vcl grid loopupbar](https://www.tmssoftware.com/site/img/asglookup.png)
Using TAdvGridLookupBar with alphabetic lookup
Drop the TAdvGridLookupBar on the form next to a TAdvStringGrid. Assign the grid to AdvGridLookupBar.Grid and set the column from where the lookup items need to be retrieved.
In code, loading the grid and initializing the lookup bar is done with:
begin AdvStringGrid1.SaveFixedCells := false; AdvStringGrid1.LoadFromCSV('c:\tmssoftware\cars.csv'); AdvStringGrid1.SortSettings.Column := 1; AdvStringGrid1.QSort; AdvGridLookupBar1.Grid := AdvStringGrid1; AdvGridLookupBar1.Column := 1; end;
Using TAdvGridLookupBar with custom category lookup
![vcl grid lookupbar](https://www.tmssoftware.com/site/img/asglookupcat.png)
This sample code snippet shows how to initialize the lookup with the 12 months of the year as category and with the category text rotated in the lookupbar:
var i: integer; begin AdvGridLookupBar1.Categories.Clear; AdvGridLookupBar1.CategoryType := custom; AdvGridLookupBar1.Rotated := true; for i := 1 to 12 do with AdvGridLookupBar1.Categories.Add do begin Text := ShortMonthNames[i]; Tag := GetGridRowOfMonth(i); end; AdvGridLookupBar1.InitLookupBarCategories; end;
Important note: it is important that the categories are added in the sequence of increasing row numbers.
Delphi project & source files for downloading included in the main demos distribution for Delphi
×