Default Sizers, First Draft (was Re: [wxPython-users] Parent of wx.BoxSizer?)

Don Dwiggins ddwiggins at advpubtech.com
Thu Jun 1 09:14:29 PDT 2006


Kevin Ollivier wrote:
> ... I think the 
> approach really will work for all but very complex systems. (e.g. those 
> that need heavily customized tab ordering) However, I think it may be
> possible to resolve even many of those limitations as I get a better 
> idea what the needs are. For example, more flexible wx tab handling 
> would address the tab issue while allowing those users to use a 
> SizedFrame/Dialog approach.

Thinking out loud:

I think there'd be a gain in simplicity and flexibility by completely 
separating the tab ordering issue from the containment hierarchy and 
from the layout mechanism.  There'd always be a default tab order in a 
top-level frame, of course, but it will likely not be what a 
conscientious designer wants.  (Or maybe not -- no designer-specified 
tab order, no effect when the tab key is pressed.)  Perhaps a "linked 
list" mechanism would be a good way to specify tab ordering: give each 
control a "TabPrevious" and "TabNext" property, each holding a reference 
to another control.  (This would allow several independent "tab 
groups".)  If these properties are empty for a control, the tab key 
wouldn't have any effect when that control has focus.

As for how many sizer types are needed, I'd say 2: the BoxSizer (with 
horizontal/vertical organization) and something like HTML's tables. 
This is the one layout that I can think of offhand that can't be covered 
by a hierarchy of box sizers -- you need the simultaneous row/column 
structure, along with the ability to "span" rows and columns where 
necessary.

I'd also offer a Panel subclass replacement for the StaticBoxSizer (this 
one's always seemed a bit strange to me -- it's the one sizer that has a 
visible component).

I've never used the GridBagSizer, but I've seen a few messages now from 
folks who have gotten frustrated with it.  Yes, it may be capable of 
covering all cases, but is it the clearest/simplest way to do it?

-- 
Don Dwiggins
Advanced Publishing Technology





More information about the wxpython-users mailing list