[wxPython-users] (Yet another) sizer question
Gavana, Andrea
gavana at kpo.kz
Tue Jun 6 07:00:47 PDT 2006
Hello Frank,
>
> Did the user widen the frame by dragging the left-hand border
> to the left, or did they do it by dragging the right-hand
> border to the right?
>
It may be an overkill but, if you handle the wx.EVT_SIZE of your frame (calling event.Skip() at the end!!!) and the EVT_MOVE and you store the position and the size of your frame, you may be able to detect which action the user has done. For example:
def OnSize(self, event):
newpos = self.GetPosition()
newsize = self.GetSize()
if newsize.x == self.storedsize.x: # nothing changed in x
event.Skip()
return
if self.storedposition.x == newpos.x:
if newsize.x > self.storedsize.x:
# user has dragged the right hand border
# and the frame is bigger
elif newsize.x < self.storedsize.x:
# user has dragged the right hand border
# and the frame is smaller
elif self.storedposition.x < newpos.x:
if newsize.x > self.storedsize.x:
# user has dragged the left hand border
# and the frame is bigger
else:
if newsize.x < self.storedsize.x:
# user has dragged the left hand border
# and the frame is smaller
self.storedsize = newsize
self.storedposition = position
event.Skip()
def OnMove(self, event):
self.storedposition = event.GetPosition()
event.Skip()
You may want to triple-check (quadruple or more) what I have wrote, I have not tested it and there may be some other case missing in the if switches. I am not sure it will work, but you can try it ;-)
Andrea.
_________________________________________
Andrea Gavana (gavana at kpo.kz)
Reservoir Engineer
KPDL
4, Millbank
SW1P 3JA London
Direct Tel: +44 (0) 20 717 08936
Mobile Tel: +44 (0) 77 487 70534
Fax: +44 (0) 20 717 08900
Web: http://xoomer.virgilio.it/infinity77
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
> Without this information my idea has no starting point.
>
> Do you know an easy way to figure this out?
>
> Frank
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail:
> wxPython-users-help at lists.wxwidgets.org
>
>
More information about the wxpython-users
mailing list