I've had a fantastic few days of coding during which I've learned how to force a screen update (I searched the forum and found Application.Processmessages ) and quite a few more facilities but I've now come to an impasse with the use of TCheckBox.
Using one which was either 'checked' or not was simple enough - a click on the box changed its state without any coding but when I came to use two - which can be both [off] or mutually exclusive - I've run into all manner of problems.
First the IDE created a [change] procedure when I anticipated a [Click] and when I put code in there it seemed to be recursive, which I found by stepping through. I then forced a [Click] Procedure using the 'Events' section and again that is recursive.
The logic I've used is
If this is [on], turn it [off], if not, turn it [on] and make sure the other is [off]
Then check again for [on] when more processing is needed.and the code is :
procedure TEllipse_Form.E_M_PresetChange(Sender: TObject);
begin
end;
procedure TEllipse_Form.E_M_PresetClick(Sender: TObject);
begin
If E_M_PreSet.checked then
E_M_PreSet.checked := false
else
begin
E_M_PreSet.checked := true;
Pre_Set_1.checked := false;
end;
if E_M_PreSet.Checked then
Get_Preset(1);
end;
procedure TEllipse_Form.Pre_Set_1Change(Sender: TObject);
begin
end;
procedure TEllipse_Form.Pre_Set_1Click(Sender: TObject);
begin
if Pre_Set_1.Checked then
Pre_Set_1.checked := false
else
begin
Pre_Set_1.checked := true;
E_M_PreSet.checked := false;
end;
if Pre_Set_1.Checked then
Get_Preset(2);
end;
I've left the 'change' Procedures in to show that they are dormant.
Stepping through with a break-point at line 7, it jumps to 11 then 7 then 11 - ad-infinitum until there is a stack overflow.
I suspect that this is due to some obvious (to those in the know) 'windows method' but would appreciate pointers to my error.