Board index » cppbuilder » How to simulate a button click, visually speaking?

How to simulate a button click, visually speaking?

Hello

I'm trying to simulate a button click. Not the OnClick event per se,
but the visualization of it, as if the mouse click on the button. I
want to make the button "depress" and then come back up.

Another user asked a similar question about TButton. The response was:

Quote
>TButton doesn't support what you're asking for.  Use TSpeedButton instead,
>it was designed to do what you're looking for.  Use it's Down property

How does that work? I've tried

  SpeedButton1->Down = True;
  SpeedButton1->Invalidate();
  DelayOSTicks( 5 * OSTICKS_mSEC_50 );  // my own delay
  SpeedButton1->Down = False;
  SpeedButton1->Invalidate();

But I don't see an visible effect. I tried adding

 Application->ProcessMessages()

after the Invalidate call, but still nothing. What's missing?

Thanks for any input,

AJ

 

Re:How to simulate a button click, visually speaking?


What is the GroupIndex property of the TSpeedButton set to?  If 0 (the
default) then the Down property will have no effect.  GroupIndex must have a
non-zero value in order for Down to do anything.

Gambit

Quote
"AJ" <wrig...@autocite-engineering-nospam.com> wrote in message

news:3c98b6ee.19011837@forums.inprise.com...
Quote
> How does that work? I've tried

>   SpeedButton1->Down = True;
>   SpeedButton1->Invalidate();
>   DelayOSTicks( 5 * OSTICKS_mSEC_50 );  // my own delay
>   SpeedButton1->Down = False;
>   SpeedButton1->Invalidate();

> But I don't see an visible effect.

Re:How to simulate a button click, visually speaking?


Also make sure that the AllowAllUp value is set to true, otherwise you won't
be able to 'pop' the button back up again if it's the only one in the group.

Phil

--

"If it is called software, why is it so hard?" - Unknown

"Remy Lebeau [TeamB]" <gambi...@yahoo.com> wrote in message
news:3c97da94$1_2@dnews...

Quote
> What is the GroupIndex property of the TSpeedButton set to?  If 0 (the
> default) then the Down property will have no effect.  GroupIndex must have
a
> non-zero value in order for Down to do anything.

> Gambit

> "AJ" <wrig...@autocite-engineering-nospam.com> wrote in message
> news:3c98b6ee.19011837@forums.inprise.com...

> > How does that work? I've tried

> >   SpeedButton1->Down = True;
> >   SpeedButton1->Invalidate();
> >   DelayOSTicks( 5 * OSTICKS_mSEC_50 );  // my own delay
> >   SpeedButton1->Down = False;
> >   SpeedButton1->Invalidate();

> > But I don't see an visible effect.

Re:How to simulate a button click, visually speaking?


On Tue, 19 Mar 2002 16:43:58 -0800, "Remy Lebeau [TeamB]"

Quote
<gambi...@yahoo.com> wrote:

Aye, thats the ticket. Setting the GroupIndex to > 0 AND AllowAllUp to
TRUE and voila! It works.

Thanks so much!

AJ

Quote
>What is the GroupIndex property of the TSpeedButton set to?  If 0 (the
>default) then the Down property will have no effect.  GroupIndex must have a
>non-zero value in order for Down to do anything.

>Gambit

>"AJ" <wrig...@autocite-engineering-nospam.com> wrote in message
>news:3c98b6ee.19011837@forums.inprise.com...

>> How does that work? I've tried

>>   SpeedButton1->Down = True;
>>   SpeedButton1->Invalidate();
>>   DelayOSTicks( 5 * OSTICKS_mSEC_50 );  // my own delay
>>   SpeedButton1->Down = False;
>>   SpeedButton1->Invalidate();

>> But I don't see an visible effect.

Re:How to simulate a button click, visually speaking?


On Wed, 20 Mar 2002 09:17:00 -0000, "Phil"

Quote
<pvalent...@continental-microwave.co.uk> wrote:
>Also make sure that the AllowAllUp value is set to true, otherwise you won't
>be able to 'pop' the button back up again if it's the only one in the group.

>Phil

Thank you for the tip - its working!

Other Threads