2

If so, how? ... Just for clarity, if there are 2 pixels between a form and object's edges, and I resize the form, I'd like the distance between the form and object to still be 2 pixels after resizing.

Thank you, as always.

Al C
  • 5,175
  • 6
  • 44
  • 74

2 Answers2

3

There's a few ways to do this but the simplest and most reliable is to script it with a resizeStack handler in your card script:

on resizeStack pWidth,pHeight
  put the rect of field "name" into tRect
  put pWidth-2 into item 3 of tRect
  set the rect of field "name" to tRect
end resizeStack
Monte Goulding
  • 2,380
  • 1
  • 21
  • 25
  • This gives me the info I need. Thank you. (I think I've gotten spoiled using IDE's and languages with properties that do a lot of this work for the developer!) – Al C Jul 09 '13 at 16:32
0

Monte's answer is dead on if what you are doing is keeping objects in a desired arrangement when resizing the stack window. But if you are wondering how to keep relative positioning while resizing or moving an object or group of objects (you said "form" so I'm assuming that's a group of objects) in a card layout, you simply have to update it in the same code that you use to resize your form or group.

constant kOffset

on resizeMyGroup
  -- code for resizing group here
  set the left of button "myButton" to the right of group "myForm" + kMargin
  set the bottom of button "myButton" to the bottom of group "myForm"
  -- etc.
end resizeMyGroup

This is the general approach to maintaining a layout in LiveCode.

Devin
  • 593
  • 1
  • 3
  • 8