Bitten by Group Default Margins

Sannyasin Brahmanathaswami brahma at
Sun May 7 00:15:02 EDT 2017

We discussed this before on this list, but I wanted to bring it up again. I don't remember any conclusions.

Are we the only ones who would prefer that the engine not auto set group margins to 4?

This bit us  hard recently as one member of the team who was not familiar with this issue spent a lot of time trying to get some dynamic responsive layout to work.

Even if the script set the group rect to

0,0,50, (the width of this card)

and then you created a background grc

0,0,50, (the width of this card)

We kept seeing a 4 pixel transparent  offset on the screen, as if the group were offset (in fact it wasn't the margins were forcing child elements to be inset, as if the coords of the child controls were relative to the 4 x offset of the group. instead of the card itself.

it got worse: even if you set the margins of the group to 0 *after* resizing all it's child elements, the prop inspector, after the layout was done, showed margins were 4 pixels, which to me seems completely "bogus"

The only way I could get it to lay out correctly was this this esoteric hack:

# at the beginning of the layout handler:

set the width of group "header" to (the width of this card +8) # over compensate for the default margins
set the left of group "header" to -4 # centers the group so that the x,y coord of the child elements are now at card edge
set the top of group "header" to 0
set the margins of group "header" to 0 # Important! so that child elements will not be offset.

# now you can set all the child elements to the width of the card
# and when you inspect the group, the topleft is 0 and the margins are 0

isn't this "just wrong" ??  Doesn't it make more intuitive sense that if I set a group topleft to 0,0 and  child element to 0,0 that it would be flush with the top left of the card?


More information about the Use-livecode mailing list