I would like to have my wx code detect when a user has resized a Frame (for example, by dragging the Frame border, etc), as opposed to when the window is resized via a call to Sizer.Fit(Frame) or Frame.SetSize(), etc. Is there any way to tell the difference?
I would like to have my wx code detect when a user has resized a Frame (for example, by dragging the Frame border, etc), as opposed to when the window is resized via a call to Sizer.Fit(Frame) or Frame.SetSize(), etc. Is there any way to tell the difference?
The event object has a Dragging() method which should do the trick.
David
The event object has a Dragging() method which should do the trick.
The EVT_SIZE event does not have that method. I presume the various mouse events do, but how do I correlate a mouse event with a frame event or determine which mouse events are doing a Frame resize?
Try this:
in the method bound to EVT_SIZE:
query for left mouse button down with:
mousevt = wx.GetMouseState()
# print dir(mousevt)
leftdown = mousevt.LeftDown()
leftdown will be True if the border had been dragged or the header had
been double clicked. In other cases like clicking minimize/maximize/
using wx.Frame.SetSize((w, h)) leftdown will be false. This works at
least at Windows.
ยทยทยท
On May 16, 6:09 pm, bht <brian.t...@anl.gov> wrote:
The EVT_SIZE event does not have that method. I presume the various mouse
events do, but how do I correlate a mouse event with a frame event or
determine which mouse events are doing a Frame resize?
Try this:
in the method bound to EVT_SIZE:
query for left mouse button down with:
mousevt = wx.GetMouseState()
print dir(mousevt)
leftdown = mousevt.LeftDown()
leftdown will be True if the border had been dragged or the header had
been double clicked. In other cases like clicking minimize/maximize/
using wx.Frame.SetSize((w, h)) leftdown will be false. This works at
least at Windows.
I though about this too, but my resize events were generated by a button click and this sometimes captured that button was down from that.
For the benefit of anyone else struggling with this, my eventual solution was to change the button event handler (fortunately there was only one) to Unbind EVT_SIZE before doing any sizing and re-Bind EVT_SIZE again at the end.