ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxpython-users
wxpython-users
[wxpython-users] Re: ScrolledPanel scrolls without touching the ScrollBar
by Antoine De Groote other posts by this author
Jul 8 2008 11:41AM messages near this date
Re: [wxpython-users] ScrolledPanel scrolls without touching the ScrollBar | [wxpython-users] Automatic exception catching and handling in Python
I found it myself now, finally after 3 hours.

ScrolledPanel.OnChildFocus() scrolls to the selected child. In my case 
this is not good, because the child itself has a lot of childs 
(textfields). So clicking one of these textfields at the bottom results 
in the fact that the parent panel (the child of the scrolledpanel) is 
scrolled to, putting the textfield out of sight again.

To remedy this, I overwrote ScrolledPanel.OnChildFocus() with this:

def OnChildFocus(self, evt):
     return

This works. I hope this doesn't violate or break some other things that 
are vital (?).

Best regards,
antoine

Antoine De Groote wrote:
>  Hello,
>  
>  I have a Notebook, which I put a NotebookPage into.
>  The notebook gets a scrolledpanel, which in turn gets a Panel. This last 
>  Panel contains some widgets, mostly labels and textfields.
>  
>  Now if I scroll this ScrolledPanel down an want to click a textfield (or 
>  by clicking anywhere in the ScrolledPanel), the Scroll moves 
>  automaticall to the top again. So I'm not able to put anything in that 
>  textfield. If I scroll down again, and click the SAME textfield, it 
>  works fine. Clicking another textfield however, results in the same 
>  strange behaviour as described above.
>  
>  Does anybody have an idea what this could come from?
>  
>  Best regards,
>  antoine
>  
>  Here's the relevant code of the notebookpage, just in case:
>  
>  class page1(wx.NotebookPage):
>      def __init__(self, parent, id):
>          #wx.Panel.__init__(self, parent, -1)
>          wx.NotebookPage.__init__(self, parent, -1)
>          self.paths = []
>  
>          #form panel
>          self.createcenterpanel()
>  
>          mainsizer = wx.BoxSizer(wx.VERTICAL)
>          mainsizer.Add(self.spanel, 1, wx.EXPAND)
>          self.SetSizer(mainsizer)
>          self.SetAutoLayout(True)
>  
>      def createcenterpanel(self):
>          sizer = wx.BoxSizer(wx.VERTICAL)
>          self.spanel = scroll.ScrolledPanel(self, -1)#, 
>  style=wx.RAISED_BORDER)
>          formsizer = wx.BoxSizer(wx.VERTICAL)
>          formsizer1 = wx.FlexGridSizer(0, 4, vgap=2, hgap=10)
>          formpanel = wx.Panel(self.spanel, -1)
>          formpanel.SetSizer(formsizer)
>          formsizer.Add(formsizer1, 0, border=10)
>          gui_util.addcontrols1(formpanel, formsizer1)
>  
>          sizer.Add(formpanel, 0, wx.EXPAND)
>          sizer.Add((58,0), 0)
>          self.spanel.SetSizer(sizer)
>          self.spanel.SetAutoLayout(1)
>          self.spanel.SetupScrolling()
>  
>  
>  
>  the function gui_util.addcontrols1 is like this:
>  
>  def addcontrols1(parent, sizer):
>      text = wx.StaticText(parent, 1, LA.CAT_TITLE_1)
>      text.SetForegroundColour('Blue')
>      sizer.Add(text, 0, flag=wx.ALIGN_LEFT|wx.ALL, border=5)
>  
>      sizer.Add(wx.StaticText(parent, -1, LA.MARQ), 0, 
>  flag=wx.ALIGN_LEFT|wx.ALIGN_BOTTOM|wx.LEFT, border=5)
>      sizer.Add(wx.ComboBox(parent, -1, '', choices=clist, size=(120,-1), 
>  style=wx.CB_DROPDOWN|wx.CB_SORT, name='marq'), 0, 
>  flag=wx.ALIGN_LEFT|wx.EXPAND|wx.LEFT, border=5)
>      [...]
>  
_______________________________________________
wxpython-users mailing list
wxpython-users@[...].org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Thread:
Antoine De Groote
Robin Dunn
Antoine De Groote

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved