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!

Disabling a check box

Status
Not open for further replies.

sanjna000

Programmer
Aug 1, 2003
132
GB
Hi,
I've got a form with a group box. That group box contains 3 check boxes. In runtime, if i uncheck two check boxes then the program should disable the remaining one. Can anyone tell me in which event of which control i have to do the checking.

Thanks a lot for u r help in advance.
Sanjna...
 
In the OnClick events of the first 2 checkboxes you mentioned write the following code:
Code:
  if (CheckBox1.Checked = False) and (CheckBox2.Checked = False) then
    CheckBox3.Enabled := False
  else
    CheckBox3.Enabled := True;
OR
Code:
  CheckBox3.Enabled := not ((CheckBox1.Checked = False) and (CheckBox2.Checked = False));

Both should work - the first example is a bit easier to read. Apologies if there's any slight mistakes - I do not have Delphi installed on this computer.


Clive [infinity]
 
Thaks a lot Clive. It works perfectly as i expected.
Sanjna...
 
Set all the Checkboxes Group Value to be not 0 and the same
for example:
Checkbox1.group {or groupindex } :=1;
Checkbox2.group {or groupindex } :=1;
Checkbox3.group {or groupindex } :=1;
Do it in design mode
I use it and works perfectly

Spent
mail:teknet@mail.orbitel.bg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top