I’ve a function that deletes a selected item from a scrolled panel. As long as I move the mouse to select an item prior to clicking on it - the delete will work. The selected item pops off the display and if there are any additional items they’ll move up to fill the vacancy. However, if I don’t move the mouse after a click and try to delete the new item that appears underneath the mouse pointer nothing happens. I have to move the mouse, even if if it’s only a few pixels in order for the click/delete to work.
I’ve seen something like this before. I think Windows needs some mouse motion events in order to know that the mouse has entered the widget’s bounds, and it won’t send click events unless it knows that the cursor is inside the widget. When the widget moves under the pointer, instead of the other way around, it confuses that logic.
Calling self.WarpPointer with an offset of (1,1) from the current position might be enough to trigger the entered state. You can use wx.MouseState to get the current position in screen coordinates, and then self.ScreenToClient to convert that to window coordinates for the call to WarpPointer.
···
On Friday, July 19, 2019 at 2:58:35 PM UTC-7, Mel Tearle wrote:
I’ve a function that deletes a selected item from a scrolled panel. As long as I move the mouse to select an item prior to clicking on it - the delete will work. The selected item pops off the display and if there are any additional items they’ll move up to fill the vacancy. However, if I don’t move the mouse after a click and try to delete the new item that appears underneath the mouse pointer nothing happens. I have to move the mouse, even if if it’s only a few pixels in order for the click/delete to work.
–
Robin
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.
Other than using WarpPointer is there any other way to simulate a mouse
pointer move?
Thanks for the help.
Mel
···
On Jul 19, 2019, at 6:15 PM, Robin Dunn <robin@alldunn.com> wrote:
On Friday, July 19, 2019 at 2:58:35 PM UTC-7, Mel Tearle wrote:
I've a function that deletes a selected item from a scrolled panel. As long as I move the mouse to select an item prior to clicking on it - the delete will work. The selected item pops off the display and if there are any additional items they'll move up to fill the vacancy. However, if I don't move the mouse after a click and try to delete the new item that appears underneath the mouse pointer nothing happens. I have to move the mouse, even if if it's only a few pixels in order for the click/delete to work.
I've seen something like this before. I think Windows needs some mouse motion events in order to know that the mouse has entered the widget's bounds, and it won't send click events unless it knows that the cursor is inside the widget. When the widget moves under the pointer, instead of the other way around, it confuses that logic.
Calling self.WarpPointer with an offset of (1,1) from the current position might be enough to trigger the entered state. You can use wx.MouseState to get the current position in screen coordinates, and then self.ScreenToClient to convert that to window coordinates for the call to WarpPointer.
Other than using WarpPointer is there any other way to simulate a mouse
pointer move?
Try wx.UIActionSimulator.MoveMouse. If that doesn’t help then you should also try doing the move (either WarpPointer or MoveMouse) from a function invoked with CallAfter so the moved widgets have a chance to process their own event handlers associate with the move first.
BTW, wx.Point (and similar classes) support + and - operators, so you can do things like this to offset a wx.Point to a new wx.Point object:
pos = wx.Point(12,34)
pos + (1,1)
wx.Point(13, 35)
···
On Friday, July 19, 2019 at 10:31:41 PM UTC-7, Mel Tearle wrote:
–
Robin
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.
the last changes moved the pointer but didn’t trip the event. I was thinking If there were a way to tell the mouse pointer that it’s left the old window and entered a new one, that might work. Is it possible to do something like that?
Thank you once again.
Mel
Hi Robin,
Tried it but it didn’t work. I could see the pointer moving on its own
but it had no effect in letting me click until I actually moved the pointer.
Other than using WarpPointer is there any other way to simulate a mouse
pointer move?
Try wx.UIActionSimulator.MoveMouse. If that doesn’t help then you should also try doing the move (either WarpPointer or MoveMouse) from a function invoked with CallAfter so the moved widgets have a chance to process their own event handlers associate with the move first.
BTW, wx.Point (and similar classes) support + and - operators, so you can do things like this to offset a wx.Point to a new wx.Point object:
pos = wx.Point(12,34)
pos + (1,1)
wx.Point(13, 35)
···
On Jul 20, 2019, at 11:05 AM, Robin Dunn robin@alldunn.com wrote:
On Friday, July 19, 2019 at 10:31:41 PM UTC-7, Mel Tearle wrote:
–
Robin
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.
On Saturday, July 20, 2019 at 2:20:33 PM UTC-7, Mel Tearle wrote:
I was thinking If there were a way to tell the mouse pointer that it’s left the old window and entered a new one, that might work. Is it possible to do something like that?