PDA

View Full Version : Is it possible to dynamically change the flex value of panels?



rtweed
30 Dec 2010, 9:12 AM
Let's say I have 2 panels in a vbox layout, but I want the top one to be visible and the lower one hidden initially, but the upper one should take up all the vertical room available initially. However, later on I want to hide the upper one and show the lower one, and now let the lower one take up all the vertical room available.

I can get the initial status working by setting a flex value of 1 and 0 respectively for the upper and lower panels. But it looks like it's not possible to dynamically flip those flex values later on to 0 and 1 respectively. Or is it?

Alternatively is there some other trick to achieving the same effect? If I could specify a height for each panel of 100% it would be ideal, but in Sencha Touch it seems the height needs to be an absolute number of pixels, which is no use for automatically catering for different devices. Hopefully someone may have a cunning solution to this dilemma?

Rob

rtweed
2 Jan 2011, 5:52 AM
Just an FYI - I got round this issue by using a card layout instead of vbox.