PDA

View Full Version : How to revert to automatic layout after manual resize via resize handles?



stahlman
12 Nov 2014, 2:02 PM
I have the following UI:
window
layout 'fit'

resizable: { handles: 'e w' }

form

layout { type: 'vbox', align: 'stretch' }

container { ... }

htmleditor { ... }


My application logic calls setWidth dynamically on the htmleditor, and expects that the window will resize to accommodate the new width. This works as expected... up until the first time I use the window's resize handles to change the width. After that, calls to setWidth on the htmleditor have no visible effect. I want to allow the user to change the width manually, but at a point determined by the application logic, I want to reassert programmatic control over the width and have the owner containers recalculated automatically as they were before the first resize.


How can I accomplish this? I'm thinking it's got something to do with the "width models" being altered by the manual size, but I haven't found much in the documentation...

--UPDATE--
Not sure whether this is the best solution, but I've discovered I can get the window to revert to automatic sizing by forcing its width/height properties to undefined. I tried this after observing that the existence of numeric values in a width/height property caused getSizeModel to choose a "configured" sizeModel for the corresponding dimension (rather than the desired "calculatedFromShrinkWrap").

Thanks,
Brett Stahlman

slemmon
13 Nov 2014, 10:01 PM
Hi,

Your solution looks right. The way the resize handles and shrinkwrap work are a bit at odds with one another.