TAdvStringGrid
Example 19 : using the new UnitEditBtn inplace editors

void __fastcall TForm1::AdvStringGrid1GetEditorType(TObject *Sender, int aCol, int aRow, TEditorType &aEditor) { if (aCol==1) { AdvStringGrid1->BtnUnitEdit->Units->Clear(); AdvStringGrid1->BtnUnitEdit->Units->Add("µA"); AdvStringGrid1->BtnUnitEdit->Units->Add("mA"); AdvStringGrid1->BtnUnitEdit->Units->Add("A"); aEditor = edUnitEditBtn; } if (aCol==2) { AdvStringGrid1->BtnUnitEdit->Units->Clear(); AdvStringGrid1->BtnUnitEdit->Units->Add("$"); AdvStringGrid1->BtnUnitEdit->Units->Add("£"); AdvStringGrid1->BtnUnitEdit->Units->Add("EU"); aEditor = edUnitEditBtn; } }
In this example, 2 columns use 2 different inplace unit editors, each requiring a different list of units, so this list is set up in the OnGetEditorType event which is called just before the inplace editing starts.
To get this project started, some cells are initialised to values that are valid for split editing in this method :
AdvStringGrid1->Cells[1][1] = "100µA";
AdvStringGrid1->Cells[1][2] = "50mA";
AdvStringGrid1->Cells[1][3] = "3A";
AdvStringGrid1->Cells[2][1] = "60$";
AdvStringGrid1->Cells[2][2] = "45£";
AdvStringGrid1->Cells[2][3] = "100EU";
Delphi project & source files for downloading included in the main demos distribution for Delphi.
×