Push state of buttons

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
 
P

Pete

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top