Is it possible to grab mouse button/motion events in a wxButton?

What I need:

grab all mouse events before they are used by the wxButton to perform
its usual work (ex: push down button or check if mouse is inside
button).

What I do:

- bind needed events (EVT_MOUSE_LEFT_DOWN/UP, EVT_MOTION, etc.)
- event.Skip (0) events I dont whant to be passed to wxButton

What I get:

Ok for mouse clicks, but mouse motion are reported only when the mouse
is outside of the wxButton, either for Skip (0) or Skip (1).

Any solution?

Thanks

···

--
Alessandro Iob <alessandro.iob@dlevel.com>
D-Level s.r.l.

Hi All -

I've got a wxOGL app which I want to be able to serve (with only partial functionality) via from a webserver. I think the easiest way to do this would be to dump the canvas to an image, and send it with an imagemap.

Does anybody have any recommendations for how to do this? Is there anything so simple as 'save dc as image.' It looks like you can save as postscript, which I could then convert, but before I dig in I was wondering if anyone could suggest a bettwer way.

Thanks for your time,

Brian

Alessandro Iob wrote:

What I need:

grab all mouse events before they are used by the wxButton to perform
its usual work (ex: push down button or check if mouse is inside
button).

What I do:

- bind needed events (EVT_MOUSE_LEFT_DOWN/UP, EVT_MOTION, etc.)
- event.Skip (0) events I dont whant to be passed to wxButton

What I get:

Ok for mouse clicks, but mouse motion are reported only when the mouse
is outside of the wxButton, either for Skip (0) or Skip (1).

Are you binding the EVT_MOTION event to the button or to its parent window? What platform and version?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Brian T. Hone wrote:

Hi All -

I've got a wxOGL app which I want to be able to serve (with only
partial functionality) via from a webserver. I think the easiest way
to do this would be to dump the canvas to an image, and send it with
an imagemap.

Does anybody have any recommendations for how to do this? Is there
anything so simple as 'save dc as image.' It looks like you can save
as postscript, which I could then convert, but before I dig in I was
wondering if anyone could suggest a bettwer way.

Create an wxEmptyBitmap of the correct size and select it into a wxMemoryDC. Then Blit from a wxClientDC of the window to the wxMemoryDC. Now the image is in the bitmap which can be saved to a file in several different image formats.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

I'm binding the EVT_MOTION both on the button and on its parent window.
I'm using wxPythonGTK-py2.2-2.4.0.7 under linux.

Sample code is attached. Note that no 'Button motion' messages are
printed when moving mouse inside button.

EvtMotionTest.py (1.34 KB)

···

On Tue, 2003-06-10 at 19:29, Robin Dunn wrote:

Are you binding the EVT_MOTION event to the button or to its parent
window? What platform and version?

--
Alessandro Iob <alessandro.iob@dlevel.com>
D-Level s.r.l.

The same code under windows works as intended.
Under Linux beside the exposed problem, double clicking on button puts
it in "clicked/down" state, till the panel is clicked.
(The EVT_LEFT_DCLICK is binded like other mouse events.)

···

On Wed, 2003-06-11 at 09:32, Alessandro Iob wrote:

I'm binding the EVT_MOTION both on the button and on its parent window.
I'm using wxPythonGTK-py2.2-2.4.0.7 under linux.

--
Alessandro Iob <alessandro.iob@dlevel.com>
D-Level s.r.l.

I have a program with a couple of wxpanels, but now i would like to
onbuttonclick
let another new panel popup and in this panel buttons etcetera. is this
possible?

Stephan

Alessandro Iob wrote:

Are you binding the EVT_MOTION event to the button or to its parent window? What platform and version?

I'm binding the EVT_MOTION both on the button and on its parent window.
I'm using wxPythonGTK-py2.2-2.4.0.7 under linux.

I should have guessed that you were on Linux, but saying that the events were coming from the parent when you didn't mention having bound them there before threw me off. The trouble is that in gtk the button (and some others) is not a true window, but just a widget that is drawn directly on its parent window. This means that the widget doesn't get the events directly but has to get the ones it is interested in from the parent, and unfortunatly it doesn't care about the motion events...

···

On Tue, 2003-06-10 at 19:29, Robin Dunn wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

stephan huijgen wrote:

I have a program with a couple of wxpanels, but now i would like to
onbuttonclick
let another new panel popup and in this panel buttons etcetera. is this
possible?

Yes. There are a few ways to do it, depending on how you want it to look/behave, but in general you just need to create the new panel just like any other, manage its size and position like any other, etc.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!