View Full Version : Square Panel/container?

15 Mar 2012, 6:17 AM
HiI need to produce a square container (height=width). I need the "square boxes' below to really be square.in the example below the width of the container should be shortened and more background green should be shown...
here is a sencha fidle code http://www.senchafiddle.com/#BLJRC that draws the image below.I am not sure where to start here. is there a simple css way of achieving this? I have tried reading the square boxes getParent().getSize() in order to see what the parent height is but that returned null for some reason...any suggestions?thanks!


15 Mar 2012, 8:07 AM
Using a box layout you won't have access to that. You can listen to the resize event to see if it fires and then update the height

15 Mar 2012, 8:29 AM
Using a box layout you won't have access to that
I am a bit confused here. what do you mean by box layout. vbox and hbox? will it work if I put fit layout instead?
aren't the getSize/getHeight/getWidth supposed to return the actual dims of a component? I cant even get the dims of the container after it has been layed out...
note that my only need is to have a square with the correct size once its placed for the first time. I don't need it to be stretchable or change size in anyway after that.

15 Mar 2012, 8:50 AM
You need to execute on the element.