Hi,
I need to use a TGroupBox with buttons (haven't determined which type yet), dynamically added and removed. I see the Addcontrol and Removecontrol methods, but I need some advice on how to actually use these methods (yes I did search, but found nothing useful). This bit of test code, just to see if I could index the controls, changes the caption of three speedbuttons that I placed on a Groupbox and works fine, ie. exactly what I hoped it would do.
What I need to do is add and remove the buttons in code:
procedure TfrmDLLTest.FormCreate(Sender: TObject);
var
i: integer;
begin
for i := 0 to 2 do
groupbox1.Controls[i].caption := inttostr(i);
end;
Can someone please provide a code snippet using GroupBox.AddControl and GroupBox.RemoveControl (or point me to some adequate documentation)?
And, how do you know which control you are removing since I cannot see anywhere to put an index. If the syntax was Groupbox1.Removecontrol.Controls[index] then that would make sense, but I do not think it is?
Any help appreciated....
Thanks,
Kevin