[wxPython-users] Focus order

Robin Dunn robin at alldunn.com
Mon Sep 4 10:48:26 PDT 2006


Josiah Carlson wrote:
> egbert <egbert.bouwman at hccnet.nl> wrote:
>> Hello,
>> wxPython is new for me, I am still experimenting.
>> This is my first post here.
>>
>> In a Frame with one Panel and one GridbagSizer the widgets 
>> receive tab-focus in the same order in which i added them 
>> to the panel and sizer.

The default order is the order they are created.

>>
>> If you have several (nested) panels and/or (nested) sizers,
>> can you then tell beforehand what the tab-focus-order will be ?
>>
>> Is it possible to change this tab-focus order, 
>> with something like set_focus_chain() in pygtk ?
> 
> See the MoveAfterInTabOrder and MoveBeforeInTabOrder methods on
> wx.Window() instances.  Generally speaking, controls will tend to only
> cycle through themselves with tab on the same window/panel.  Nested
> panels would require custom code to handle the tabs.

Actually, tabbing into or out of a nested panel usually works fine.  The 
order within the nested panel defaults to the order that those controls 
were created, just like the parent panel.  The default order of getting 
into or out of the panel is the order that the panel and its siblings 
were created.

In other words, if you create the items like this, then this is the 
default tab order:

	control1
	control2
	control3
	nested-panel
		nested-control1
		nested-control2
		nested-control3
	control4
	control5
	control6

Using Move[After|Before]InTabOrder you can change the order of things at 
the outer level, and also in the nested level, but you can't make an 
order like this without custom code:

	control3
	nested-control1
	control1
	nested-control2
	control2
	nested-control3
	control4
	control5
	control6


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list