Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stack Overflow when Check Box is clicked 1

Status
Not open for further replies.

CarrahaG

Programmer
Mar 25, 2007
98
AW
Hi

Why am I getting a stack overflow situation when I click on a check box called "ChkBoxActive". The "On Click" procedure is below:

procedure TfrmCPInvoices.ChkBoxActiveClick(Sender: TObject);
begin
if (ChkBoxActive.Checked = True) then
ChkBoxActive.Checked := False
else
ChkBoxActive.Checked := True;
end;

I simply want it to check the box on click and uncheck it when it is clicked again.

Regards,
George
 
to check or uncheck a checkbox requires no code.

your geting yourself into a loop.
when you set the checkbox by code it triggers an onclick event so your code is causing the box to check & uncheck until the stack cant take it anymore.

if you want to check / uncheck a checkbox via code from a button click its

chkboxActive.checked := not chkboxActive.checked;


Aaron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top