PDA

View Full Version : Problems with anchor layout



dbassett74
28 Jun 2010, 7:38 AM
It seems like the anchor layout (and its extended class abosolute) is not working correctly. If I type in "right" for the anchor of a button, it doesn't anchor to the right like I would expect. And in absolute layout, nothing happens as well. Absolute extends anchor, so shouldn't anchor be available in absolute as well?

jarrednicholls
28 Jun 2010, 8:06 AM
I'm not sure why it isn't working, although as a user of Ext JS I have experienced this in the past and resorted to simply using % or absolute anchors. If you supply "0" or "100%", those are both the same as "right" and you will see that it works correctly. I'll look into this further and see if it is an Ext JS bug. Thanks.

dbassett74
28 Jun 2010, 8:19 AM
I tried the 100% and it does now snap the right side of the button to the right side of the window, but, it stretches the button. Isn't there a way to have it honor the set width of the button, but still make it snap to the right without stretching the button?

jarrednicholls
28 Jun 2010, 8:36 AM
That is the behavior of an anchor layout. It anchors the right or bottom edges according to your anchor configuration, so when a container is resized, its anchored components will resize themselves to keep their right and bottom edges "anchored" accordingly. Stretching is precisely what is suppose to happen...it's not an "alignment", it's specifically for resizing. You would be more interested in putting the button in an hbox layout if alignment is what you desire.

Hope that helps.