Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about TBitBtn

19 views
Skip to first unread message

Andre

unread,
Jun 4, 2008, 1:20:09 PM6/4/08
to
Hello,

I think it is something simple, but I coudn´t find the solution myself.

I want a bi-state button. I tried SpeedButton, but it didn´t respond to
the hotkey in its caption, so I forgot this one.

TButton doesn´t seem to have this funcionality, and then I go for
TBitBtn (wich I prefer, anyway).

But I can´t find the "Down" property of if! How do I use that. The help
for this TBitBtn even says, for the Glyph property that it has the
"Down" state. It accecpts 4 images in the glyph.

But I am lost on how to use it. I don´t wanna images (necessarily). I
just want it to toogle the pressed look each time the user clicks.

Can you help me?

Thanks.

André

Andre

unread,
Jun 5, 2008, 10:52:53 AM6/5/08
to

> I want a bi-state button. I tried SpeedButton, but it didn´t respond to
> the hotkey in its caption, so I forgot this one.

I missed something here. It *DID* respond to the hotkey on its caption,
but it didn´t changed the Down property as I expected it to.

Any ideia why this happens?

Remy Lebeau (TeamB)

unread,
Jun 5, 2008, 1:19:33 PM6/5/08
to

"Andre" <av...@bios.srv.br> wrote in message
news:4847fe2a$1...@newsgroups.borland.com...

> I missed something here. It *DID* respond to the hotkey
> on its caption, but it didn´t changed the Down property as I
> expected it to.

It is not supposed to. You can set the property manually, though, ie:

void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
SpeedButton1->Down = !SpeedButton1->Down;
}


Gambit


Andre

unread,
Jun 6, 2008, 11:33:43 AM6/6/08
to

>> I missed something here. It *DID* respond to the hotkey
>> on its caption, but it didn´t changed the Down property as I
>> expected it to.
>
> It is not supposed to. You can set the property manually, though, ie:
>
> void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
> {
> SpeedButton1->Down = !SpeedButton1->Down;
> }

The problem with this solution is that when the user clicks with the
mouse, the Down property is already changed (so it would reset it). When
the keyboard is used, it would work as intended.

I don´t know how to tell wich situation happened.

Since you said it is not supposed to, would it be good to send some code
for you all to see?

Thanks, Gambit.

Remy Lebeau (TeamB)

unread,
Jun 6, 2008, 12:18:27 PM6/6/08
to

"Andre" <av...@bios.srv.br> wrote in message
news:4846cf2f$1...@newsgroups.borland.com...

> I want a bi-state button
<snip>


> I just want it to toogle the pressed look each time the user clicks.

Using TSpeedButton, simply set the AllowAllUp property to true, and the
GroupIndex to a non-zero value. The button will then toggle its Down
property automtically when clicked without any extra code needed.


Gambit


Remy Lebeau (TeamB)

unread,
Jun 6, 2008, 12:16:51 PM6/6/08
to

"Andre" <av...@bios.srv.br> wrote in message
news:4849593c$1...@newsgroups.borland.com...

> The problem with this solution is that when the user clicks
> with the mouse, the Down property is already changed (so
> it would reset it). When the keyboard is used, it would work
> as intended.

TSpeedButton is not a windowed control, so it can never receive keyboard
input to begin with.


Gambit


Andre

unread,
Jun 11, 2008, 10:59:47 AM6/11/08
to Remy Lebeau (TeamB)

> TSpeedButton is not a windowed control, so it can never receive keyboard
> input to begin with.

And if I want ao bi stable button that receives keyboard input should I
write a new class? :/

Andre

unread,
Jun 11, 2008, 11:00:49 AM6/11/08
to

>> I want a bi-state button
> <snip>
>> I just want it to toogle the pressed look each time the user clicks.
>
> Using TSpeedButton, simply set the AllowAllUp property to true, and the
> GroupIndex to a non-zero value. The button will then toggle its Down
> property automtically when clicked without any extra code needed.

I knew. But the problem is the keyboard input, as you also said.

Tom420

unread,
Aug 3, 2008, 3:39:44 PM8/3/08
to
Andre wrote:

> and then I go for
> TBitBtn (wich I prefer, anyway).
>
> But I can´t find the "Down" property of if!

I believe the Checked property of the TBitBtn does what you intend.

Hope this helps,
Tom :)

0 new messages