Momentary button

Am I right in thinking that wxButton cannot bind in a momentary fashion,
ie trigger an event when the mouse button is pressed (on the button),
and another when it is released? I have tried to bind it using
wx.EVT_LEFT_DOWN, but the event is not triggered. I get the feeling
that the only event that can be detected is that the mouse button has
been clicked and released. Is that correct?

If that is so (surprising) I guess I have to detect mouse hover over the
button AND left button down. Seems a little clumsy maybe?

Greg

THis may well be platfrom-dependent behaviour. As wx uses the platfrom
native widgets, it's really only reliable to use a button like a
button is usually used.

I"d take a look at wx.lib.button.GenButton (and others in
wx.lib.buttons) -- that should be easier to customize.

-Chris

···

On Thu, May 24, 2012 at 2:11 AM, Greg - ZL3IX <zl3ix@inet.net.nz> wrote:

Am I right in thinking that wxButton cannot bind in a momentary fashion,
ie trigger an event when the mouse button is pressed (on the button),
and another when it is released? I have tried to bind it using
wx.EVT_LEFT_DOWN, but the event is not triggered. I get the feeling
that the only event that can be detected is that the mouse button has
been clicked and released. Is that correct?

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Many thanks for the tip, Chris.

That worked a treat!

Greg

···

On 2012-05-25 05:20 a.m., Chris Barker wrote:

On Thu, May 24, 2012 at 2:11 AM, Greg - ZL3IX<zl3ix@inet.net.nz> wrote:

Am I right in thinking that wxButton cannot bind in a momentary fashion,
ie trigger an event when the mouse button is pressed (on the button),
and another when it is released? I have tried to bind it using
wx.EVT_LEFT_DOWN, but the event is not triggered. I get the feeling
that the only event that can be detected is that the mouse button has
been clicked and released. Is that correct?

THis may well be platfrom-dependent behaviour. As wx uses the platfrom
native widgets, it's really only reliable to use a button like a
button is usually used.

I"d take a look at wx.lib.button.GenButton (and others in
wx.lib.buttons) -- that should be easier to customize.

-Chris