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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to disable/enable at runtime a TGroupBox? 2

Status
Not open for further replies.

clifff

Programmer
Mar 22, 2002
20
MD
Hi 2ffatt and others! I want to make a panel(TGroutBox) to be desabled (showing all the buttons on it but grey colored)and after a click to enable it. All i found is TGroupBox->Enabled property that desable editing in the edits on the panel. But i want that mistery grey color to be on disabled mode.

Thanks, clifff.
 
Off the top of my head, you may have to disable each component in the group box. For example, if the group box has three buttons, each button would have to have its enabled property set to false.
Code:
Button1->Enabled = false;
Button2->Enabled = false;
Button3->Enabled = false;

Then when you want them enabled, some section of could look like this
Code:
Button1->Enabled = true;
Button2->Enabled = true;
Button3->Enabled = true;
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Ok, but how do i make them to look gray when disable? Becose the ->Enabled property for edit boxes make that just non-editable! Are there any other property?

Thanx for Your help!
 
You have to acces their individual colors

for example:

Edit1->Font->color = clGray;
Edit1->Color = clMenu;

Although disabling them should take care of the font color
by itself

Disabling a button will also turn its font to the normal button color rather than black
 
Check TWinControl::Controls in the help files. This is the example they use:
Code:
for(int i=0; i < RadioGroup1->ControlCount; i++)
		RadioGroup1->Controls[i]->Visible = false;
Just change it to look like:
[/code]
for(int i=0; i < GroupBox1->ControlCount; i++)
GroupBox1->Controls->Enabled = false;
[/code]
This will cycle through all the controls on the group box and disable them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top