From: Alex T. <al...@tw...> - 2004-09-13 21:30:26
|
At 13:47 13/09/2004 -0700, Donnal Walter wrote: ><delurking> >Aha! A critical insight. If I understand correctly this "flat" >model also explains (at least in part) why sizers are problematic >to implement in the framework. Ideally, each container should have >a built-in sizer to which components are automatically added as >they are added to the container. The kind of sizer should be >determined by the container, and the parameters for each component >should be passed like 'size' and 'pos' are now. If PythonCard had a non-flat model, then it would be easier to change it to have explicit containers (each being a sizer of one kind or another). But I think there's a more fundamental problem: it would require a different approach to laying out your GUI. Using sizers kind of requires that you have a plan for the layout of controls, and can then describe a hierarchy of sizers and place controls within them. This is, I think, rather contrary to the freedom that PythonCard gives you to rapidly prototype and play with different controls and arrangements of them. There's certainly a contradiction between the idea that you "place" controls (as in Pythoncard) versus "arrange the order and relative position" of controls, and let sizers shuffle them into their final (but dynamic) positions. I've been playing around with sizers in Pythoncard; I've built a couple of "auto-sizer" functions that take a component layout as found in a resource file, and generate a reasonable first-cut at arranging those into sizers. Basic idea is that it should take the component positions (and use some default assumptions about different components) to build a default set of sizers. This can be aided by some "hints" added to the component data (currently using "custom data" in the components, but if the idea ever gets anywhere, it might be possible to add something to the resource editor to support this more directly) to guide its actions. The auto-sizer can then either just operate, or it can spit out the source code that will make equivalent simple sizer calls, and can therefore be the starting point for custom programming. I was feeling quite optimistic about it a couple of weeks ago - and then got side-tracked. I'll work on it a bit more, and if I can come up with something that works well enough, and is easy to explain, I'll make it available to anyone who wants to play around with sizers. -- Alex. |