From: Alex T. <al...@tw...> - 2005-04-30 14:30:41
|
Michael Sorich wrote: >I have written some code to reposition/resize >components with changes in Background (wxFrame) size. >There are 3 options. The only requirement for each is >that the anchors property is set for each component – >these indicate how the component should move/size with >respect to its environment. I have attached a simple >example GUI that can be run to demonstrate the 3 >layout managers. The layout manager and anchors for >each component can be changed in >MyBackground.on_initialize. > >1) Simple anchors > too simple ... >2) Relative anchors > still too simple .... >3) Advanced anchors > getting interesting ... >I would be interested in comments and examples where >these layout managers do and do not work well. > > Only talking about Advanced anchors - the others really do hit their limits very quickly. 1. In the example you sent out, try to add a "Button 3" mid-way between B1 and B2. I'd like B3 to remain mid-way between them as the window width is varied. Can't do that currently. Would be easy enough to add a "fixed-size" flag, so that it could be anchored to L and R, position calculated as it is currently - but then adjusted to keep the size unchanged. (i.e. it would find the right place to grow into - but not grow, leaving space on each side). 2. (This may really be 1a :-) In the devx article you mentioned, they had a static text (label) beside a text area; as the text area grows, the label should "float" to remain half-way up the side. 3. Mix of expanding and non-expanding components. label 1: [.Txtfld 1...] label 2: [.Txtfld 2...] label 3: [.......tf3.] where you want the labels to stay fixed-width, and the fields to grow to fill the available width. (I don't think there's a way to do just that). 4. Interference. Extend the last case ... [button 1 across here about this long] label 1: [.Txtfld 1...] label 2: [.Txtfld 2...] label 3: [.......tf3.] where you want the labels to stay fixed-width, and the fields to grow to fill the available width. The edges of button1 become partition edges - and so change the growth patterns of the textfields 1 and 2. If you put the button way up at the top of the background, and the fields way at the bottom - with a lot of other stuff in between, it would be very hard to understand what's going on ... -- Alex. -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 27/04/2005 |