[wxPython] how to manually trigger a mouse event?

2 views
Skip to first unread message

Robin Barendregt

unread,
Mar 31, 2000, 7:58:57 PM3/31/00
to Wxpython-Users@Server. Python. Net
Hi all,

win98se, wxPython 2.1.14

I was wondering how I could fool the system into believing a EVT_LEFT_UP
happened.
If I have a canvas with a panel on top of it, and I press the left mouse
button when on the panel, I send CaptureMouse() to the canvas in my
EVT_LEFT_DOWN handler. When I lift the button up again, in my EVT_LEFT_UP
handler, my GetEventObject() is the canvas because of the capture mouse, but
I really want it to be the panel, since that's what's underneath my cursor.
I was assuming that I should send ReleaseMouse() to the canvas and process
another EVT_LEFT_UP without touching the mouse, then the event object should
be the panel. Am I correct in assuming this? If so, how do I make the left
up happen.

TIA,
Robin.


_______________________________________________
wxPython-users maillist - wxPytho...@starship.python.net
http://starship.python.net/mailman/listinfo/wxpython-users


Robin Dunn

unread,
Apr 3, 2000, 12:11:07 PM4/3/00
to Robin Barendregt, wxpytho...@server.python.net
>
> I was wondering how I could fool the system into believing a EVT_LEFT_UP
> happened.
> If I have a canvas with a panel on top of it, and I press the left mouse
> button when on the panel, I send CaptureMouse() to the canvas in my
> EVT_LEFT_DOWN handler. When I lift the button up again, in my EVT_LEFT_UP
> handler, my GetEventObject() is the canvas because of the capture mouse,
but
> I really want it to be the panel, since that's what's underneath my cursor.

Why CaptureMouse on the canvas and not the Panel? If you want the panel to
get the events, then it should be the one that does the capture and release.


> I was assuming that I should send ReleaseMouse() to the canvas and process
> another EVT_LEFT_UP without touching the mouse, then the event object
should
> be the panel. Am I correct in assuming this? If so, how do I make the left
> up happen.
>

You will probably have to resend the event. Change the appropriate values in
the event object, then call panel.GetEventHandler().ProcessEvent(event)

--
Robin Dunn
Software Craftsman
ro...@AllDunn.com
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/ Check it out!

Reply all
Reply to author
Forward
0 new messages