InsertControl (C++)
From RAD Studio Code Examples
Description
The example shows how to add a control to a grid using the InsertControl method. To build this example, add a TDrawGrid object on the form. Add the code below to the form's constructor. The result is that a combo box is added in the second cell on the first row.
Code
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { TComboBox *combo; TRect rect; TEdit *edit; combo = new TComboBox(this); rect = DrawGrid1->CellRect(2,0); combo->Top = rect.Top; combo->Left = rect.Left; DrawGrid1->InsertControl(combo); DrawGrid1->ColWidths[2] = combo->Width; edit = new TEdit(this); rect = DrawGrid1->CellRect(3,0); edit->Top = rect.Top; edit->Left = rect.Left; DrawGrid1->InsertControl(edit); DrawGrid1->ColWidths[3] = combo->Width; }