I have a window derived from wx.Window which has several standard controls plus a control derived from wx.ScrolledWindow. Pressing the tab key moves the focus between the standard windows but the focus never moves to my derived window. I can click on my derived control and focus does move to it then.
You should try to use ScrolledPanel from wx.lib.scrolledpanel.
It has code to handle tab traversal correctly.
Bruce at blazer wrote:
···
Hi All,
I have a window derived from wx.Window which has several standard controls plus a control derived from wx.ScrolledWindow. Pressing the tab key moves the focus between the standard windows but the focus never moves to my derived window. I can click on my derived control and focus does move to it then.
I have a window derived from wx.Window which has several standard controls plus a control derived from wx.ScrolledWindow. Pressing the tab key moves the focus between the standard windows but the focus never moves to my derived window. I can click on my derived control and focus does move to it then.
Just to clarify: You want to be able to tab into the scrolled window itself, not to some child widget, right? If so I would have expected the above to work, although the wx.WANTS_CHARS can prevent the TAB out of the widget (but that can be fixed by handling the TAB yourself and calling Navigate.) What platform/version are you using?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Just to clarify: You want to be able to tab into the scrolled window
itself, not to some child widget, right? If so I would have expected
the above to work, although the wx.WANTS_CHARS can prevent the TAB out
of the widget (but that can be fixed by handling the TAB yourself and
calling Navigate.) What platform/version are you using?
Yes, I want to Tab into the scrolled window itself. It just seems to bypass this window altogether.
I am handling the TAB to navigate out of this window if it has the focus.
Does my scrolled window have to have a special style to tell the system it should be included in the tab order. Windows has a style ‘WS_TABSTOP’ for this but I can’t find the equivalent in wxWindow / wxPython.
I’m running on Windows, python 2.5 and wxPython 2.8.6.0
> Just to clarify: You want to be able to tab into the scrolled window
> itself, not to some child widget, right? If so I would have expected
> the above to work, although the wx.WANTS_CHARS can prevent the TAB out
> of the widget (but that can be fixed by handling the TAB yourself and
> calling Navigate.) What platform/version are you using?
Yes, I want to Tab into the scrolled window itself. It just seems to bypass this window altogether.
I am handling the TAB to navigate out of this window if it has the focus.
Does my scrolled window have to have a special style to tell the system it should be included in the tab order. Windows has a style 'WS_TABSTOP' for this but I can't find the equivalent in wxWindow / wxPython.
I think that all wx controls get it automatically.
Try deriving your class from wx.PyScrollWindow and override the AcceptsFocus method and have it return True.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!