[wxPython] Splitter Event not working!

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] Splitter Event not working!

Cliff Baeseman
I have a little question here maybe someone has run into this before. I
attach a event using the below line and the event is not being called at
all during the slider change. I am giving the ID of the wxSpltterWindow
but it is not calling my event during the position change at all. Do I
have to attach the event to one of the panels or something I have tried
most of them already and nothing seems to work. I have included my code
below. It is a little beat up because I have been hacking the hell out
of it trying to get it to work

EVT_SPLITTER_SASH_POS_CHANGED(self, 3008, self.OnSliderChange)

This is all contained in a wxFame class BTW

Cliff Baeseman


#create designer and tool panel and split
   splitter = wxSplitterWindow(self,3008)
   toolbar = PBToolBar(splitter,-1)
   designer = wxSplitterWindow(splitter,-1)
   splitter.SplitVertically(toolbar,designer)
   splitter.SetSashPosition(100)
   rightpane = wxSplitterWindow(designer,-1)
   leftpane = PBDesignerPanel(designer,-1)
   designer.SplitVertically(leftpane,rightpane)
   designer.SetSashPosition(200)

   explorer =  PBProjectExplorer(rightpane,-1)
   propertypane =  wxPanel(rightpane,-1)
   rightpane.SplitHorizontally(explorer, propertypane)
   rightpane.SetSashPosition(150)

   EVT_SPLITTER_SASH_POS_CHANGED(self, 3008, self.OnSliderChange)

  def OnSliderChange(self,event):
   print "changed"



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] Splitter Event not working!

Robin Dunn
> I have a little question here maybe someone has run into this before. I
> attach a event using the below line and the event is not being called at
> all during the slider change. I am giving the ID of the wxSpltterWindow
> but it is not calling my event during the position change at all. Do I
> have to attach the event to one of the panels or something I have tried
> most of them already and nothing seems to work. I have included my code
> below. It is a little beat up because I have been hacking the hell out
> of it trying to get it to work
>
> EVT_SPLITTER_SASH_POS_CHANGED(self, 3008, self.OnSliderChange)
>
> This is all contained in a wxFame class BTW

There's a bug in wxSplitterWindow, (now fixed.)  It doesn't set the window ID
in the event object so the matching event handler is not found properly.  To
work around this use -1 for the ID in your EVT_SPLITTER...

This has the side-effect that events all splitters that are children of self
will have their events going to your handler, but since you will probably
only have one it is no big deal.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users