an alternative approach to layout management

On Wed, 19 Nov 2008 14:26:03 -0700, Joe Strout <joe@strout.net> wrote"

The long-term idea here is that we could make a visual GUI builder
that would let you start by just dragging your widgets around on the
panel, storing absolute positions. But then you could right-click (or
click a pop-up widget of some sort) on any of the position terms, and
it would suggest a set of other, more dynamic ways of encoding the
same thing. For example, if button 2 is next to button 1, it could
suggest things for its posLeft like 'button1.right + gap' or
'parent.midX + halfgap' or whatever may apply.

In this way, you have a very natural transition from a quick
hacked-together static UI, to one that's dynamic and flexible. You
don't have to switch to a completely different approach to get the
benefits of a dynamic UI; you can just fix up your initial layout,
window by window.

But we don't have a layout builder yet, we just have this text
format. But already I find it much easier. For example, we had a
half-dozen messages today on how to center a button within its parent
panel. With FlexPanel, that would have been simply:

    posMidX = parent.MidX

with no mystery about it. What do you think?

There's no cool automatic widget to drive it, but your concept sounds
very close to the wx.LayoutConstraints concept that is already in
wxPython. The layout of each widget is specified in terms of its
neighbors or parents, or absolutely. I had a case last year where I
couldn't easily describe my layout with sizers, but wx.LayoutConstraints
handled it just fine. You might look at the LayoutConstraints.py file
in the wx demo to see if there is some synergy with what has already
been done.

ยทยทยท

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.