Jump to content
Skullcode

Tbutton Flashing

Recommended Posts

Use a TTimer to change the color of the button periodically. If you need a lot of them, you can derive your own TFlashingButton class/component to have an easy to use flashing button on the tool palette.

 

  • Like 1

Share this post


Link to post

AFAIK you can't change the colour or event the font colour of a standard TButton. You can derive your own button with a canvas (which I have done in the past), but its quite a lot of work and won't work decently with themes.

 

Francois' suggestion of a timer is sound, but I would suggest internittently enabling/disabling the button to provide a flash effect/

  • Like 1

Share this post


Link to post
4 hours ago, Mark Williams said:

AFAIK you can't change the colour or event the font colour of a standard TButton.

Not by default, but you can manually enable the BS_OWNERDRAW style on it, and then intercept WM_DRAWITEM messages sent to it.  Then you can make it look however you want.

4 hours ago, Mark Williams said:

I would suggest internittently enabling/disabling the button to provide a flash effect

Or, simply use a different Button control that supports custom coloring, like TBitBtn (which already has the BS_OWNERDRAW style) or TSpeedButton.

  • Like 1

Share this post


Link to post
26 minutes ago, David Heffernan said:

Flashing can be quite visually aggressive.

Yeah. There's a reason we don't have <BLINK> in HTML anymore.

 

P.S. I just tried googling "blink html"... WTH? Do they think they're clever? Okay they're a bit clever because if you google "html blink" the result differs subtly.

Share this post


Link to post

Here is another idea - instead of flashing the Button itself, place it inside a Panel whose borders appear slightly beyond the Button's edges, and then flash the Panel as needed.  Or, create an alpha-blended overlay window, place it over the Button, and then hide/show the window as needed.

  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×