[wxPython] Mouse event questions

Could you use:

  wxMouseEvent::Dragging()

Yes, you still have to use the same handler for all the motion stuff, but
it's a fairly simple if statement. You can use:

  wxMouseEvent::LeftDown()

to determine the button that is dragging to switch to the appropriate
handler.

Now, obviously, that doesn't give you a way of "guessing" whether the
down-click is going to be a drag or not. A handler that just receives
EVT_LEFT_CLICK or EVT_RIGHT_CLICK would be nice, otherwise you need two
handlers, one that's EVT_MOTION, one that's EVT_LEFT_UP, and you need to
disregard the EVT_LEFT_UP's that have a preceding drag event. Doing that,
unfortunately, requires tracking EVT_DOWNs so you know when "before" is
"before". Not a great situation all-in-all.

HTH somehow,
Mike

···

-----Original Message-----
From: Chris Barker [mailto:cbarker@jps.net]
Sent: Tuesday, December 19, 2000 5:36 PM
To: wxpython-users@lists.sourceforge.net
Subject: Re: [wxPython] Mouse event questions

"Robert B. Klimek" wrote:

>There doesn't seem to be what I would expect: a "EVT_LEFT_DRAG" event.
>Instead, looking at the demo, and the wxWindows code, it seems there is
>an EVT_MOTION enent that I have to capture. This means that every time
>the mouse is moved, whether a button is pressed or not, my mouse motion
>handler is called, and I have to check to see if it is a drag enent, and
>if so, I have to have some way of knowing which button is pressed. This
>means that that handler is going to be getting called constantly (which,
>frankly doesn't seem to slow anything down), but also that I have to do
>a lot of logic to figure out what exactly is happening.
>
>It seems that I am doing much lower level stuff than I should have to.
>Am I missing something?
>

Use EVT_MOTION along with EVT_LEFT_DOWN.
Bob

Thanks, I have it working now, but it seems that what I now am left with
is having to pass virtually all the mouse events through the same
handler, because I don't know whether the mouse is going to be dragged
or not when a EVT_LEFT_DOWN happens, for instance. Then, when an
EVT_MOTION happens, I don't know whether it is a simple move or a drag,
and whoch button is pressed if it is a drag. The net result is that
every mouse event has to be passed through one handler, that figures all
this out. If there was an EVT_LEFT_DRAG event, then I could process
right and left button events separately, and move and drag events
separately.

--
Christopher Barker,
Ph.D.
cbarker@jps.net --- --- ---
http://www.jps.net/cbarker -----@@ -----@@ -----@@
                                   ------@@@ ------@@@ ------@@@
Water Resources Engineering ------ @ ------ @ ------ @
Coastal and Fluvial Hydrodynamics ------- --------- --------
------------------------------------------------------------------------
------------------------------------------------------------------------

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users