Board index » cppbuilder » Using TButtonGroup with disabled actions

Using TButtonGroup with disabled actions


2006-11-02 06:06:22 PM
cppbuilder88
Hi,
I have discovered a nice control called TButtonGroup. We have an
application with a lot of actions, stored in an action list. We assign
these actions to buttons within the button group, but then we came
across a tiny anoying problem.
Actions can be enabled or disabled, but this state is not reflected by
the button on the group, and a disabled action can even be fired by the
group button. The GrpButtonItem does not have an Enabled property, so my
question is: How can I disable group buttons in another way?
Thanks in advance for any help,
Wiljo.
 
 

Re:Using TButtonGroup with disabled actions

Put them on a TPanel and enable/disable the panel.
Tom Woodrow
Wiljo wrote:
Quote
Hi,

I have discovered a nice control called TButtonGroup. We have an
application with a lot of actions, stored in an action list. We assign
these actions to buttons within the button group, but then we came
across a tiny anoying problem.

Actions can be enabled or disabled, but this state is not reflected by
the button on the group, and a disabled action can even be fired by the
group button. The GrpButtonItem does not have an Enabled property, so my
question is: How can I disable group buttons in another way?

Thanks in advance for any help,

Wiljo.
 

Re:Using TButtonGroup with disabled actions

Tom Woodrow wrote:
Quote
Put them on a TPanel and enable/disable the panel.

Tom Woodrow

That doesn't work, and isn't needed. The TButtonGroup has an Enabled
property, so it is possible to enable or disable the whole group.
I want to be able to enable or disable individual buttons, or let them
reflect the enabled state of the associated Action. This is clearly not
possible.
The alternative Darl suggested is probably the best working way to go,
albeit a little strange; testing the Enabled state of an action within
the actions Execute method! Normally that test would not be necessary.
The button is always active, even when it's action is not. The users of
our programs will get confused by this behaviour. Is there maybe another
button control that does have this functionality? Or would I have to
write my own control?
Thanks anyway,
Wiljo.
 

{smallsort}

Re:Using TButtonGroup with disabled actions

I can't find TButtonGroup in BCB5, what version are you using?
Tom
 

Re:Using TButtonGroup with disabled actions

Tom Woodrow wrote:
Quote
I can't find TButtonGroup in BCB5, what version are you using?

Tom
Well it is a new control in BDS2006. It is in the Additional section
where TStaticText also resides. It is not present in BCB6 either!
Wiljo.
 

Re:Using TButtonGroup with disabled actions

Depending on how and where you used the TButtonGroup Ctrl, you could use the
TFlowPanel Ctrl with TSpeedButton inside,
Set the Flat proptery of the SpeedButton to true and you will have something
simlar (not exactly the same) to the ButtonGroup and the SpeedButton have
Enabled property and can bind to Action objects.
Good Luck!!
Darl
"Wiljo" < XXXX@XXXXX.COM >wrote in message
Quote
Tom Woodrow wrote:
>Put them on a TPanel and enable/disable the panel.
>
>Tom Woodrow
>
That doesn't work, and isn't needed. The TButtonGroup has an Enabled
property, so it is possible to enable or disable the whole group.

I want to be able to enable or disable individual buttons, or let them
reflect the enabled state of the associated Action. This is clearly not
possible.

The alternative Darl suggested is probably the best working way to go,
albeit a little strange; testing the Enabled state of an action within
the actions Execute method! Normally that test would not be necessary.

The button is always active, even when it's action is not. The users of
our programs will get confused by this behaviour. Is there maybe another
button control that does have this functionality? Or would I have to
write my own control?

Thanks anyway,

Wiljo.
 

Re:Using TButtonGroup with disabled actions

Darl wrote:
Quote
Depending on how and where you used the TButtonGroup Ctrl, you could use the
TFlowPanel Ctrl with TSpeedButton inside,

Set the Flat proptery of the SpeedButton to true and you will have something
simlar (not exactly the same) to the ButtonGroup and the SpeedButton have
Enabled property and can bind to Action objects.

Good Luck!!

Darl

Thanks,
That is exactly what I wanted.
Wiljo.