Ok, thanks for the help! One last question.
I'm looking to dynamically add or remove buttons from a form, based on user specified numbers.
This is what I have so far, for adding the buttons in:
SCAR Code:
Try
Begin
For I := 1 To StrToInt(Edit1.text) Do
Begin
SetArrayLength(Buttons[I].Mine[I], StrToInt(Edit2.text));
SetArrayLength(Buttons[I].Button[I], StrToInt(Edit2.text));
SetArrayLength(Buttons[I].Number[I], StrToInt(Edit2.text));
End;
For C := 0 To StrToInt(Edit1.text) Do
For I := 0 To StrToInt(Edit2.text) Do
Begin
With Buttons[I].Button[I] Do
Begin
Parent := Wagh;
Left := 8;
Top := 6;
Width := 19;
Height := 19;
TabOrder := 8;
End;
End;
End;
Except
Begin
Edit1.Text := 'Please enter a number!';
Edit2.Text := 'Please enter a number!';
End;
Finally
End;
The only problem is that it throws a runtime error which I have yet to figure out.
If you spot anything wrong with that, let me know!
This is how I declared TButtonEdit as a type:
SCAR Code:
Type TButtonEdit = Record
Button : Array of TButton;
Mine : Array of Boolean;
Number : Array of Integer;
End;
Here's how I declared Buttons:
SCAR Code:
Buttons : Array of TButtonEdit;
~Sandstorm