Push state of buttons

  • Thread starter Thread starter Markus Minichmayr
  • Start date Start date
M

Markus Minichmayr

Hi!

How can I determine wether a button is currently pushed or not?

I want to create my own button with a non-rectangular shape and a special
design. For that I created three images, one for released, pushed and
disabled state. At the Paint event I want to draw the correct image and give
the corresponding shape. However, I don't know, how to determine, whether
the button is currently pushed or not. I only get a Click event when the
button was pushed and released again, but the Pushed image should already be
painted when the button is pushed and before it is released again. What I
need is something like a ButtonPushed and a ButtonReleased event. Of course
I could monitor the mouse events and react on MouseDown, MouseUp,
MouseLeave, ... but that seems to be pretty much effort for information that
should be available directly. Who can help?

Thanks
Markus
 
Hi,

Markus said:
like a ButtonPushed and a ButtonReleased event. Of course I could
monitor the mouse events and react on MouseDown, MouseUp, MouseLeave,
... but that seems to be pretty much effort for information that
should be available directly. Who can help?

I don't see how it could be much more direct than that. Assuming you are
actually deriving from Button you can just override OnMouseWhatever.. it's
hardly any effort.

If you aren't deriving from Button then I'd reconsider your approach if I
were you.

-- Pete
 
Back
Top