2

如果是这样,怎么做?...为了清楚起见,如果表单和对象的边缘之间有 2 个像素,并且我调整了表单的大小,我希望表单和对象之间的距离在调整大小后仍然是 2 个像素。

谢谢你,一如既往。

4

2 回答 2

3

有几种方法可以做到这一点,但最简单和最可靠的是在您的卡片脚本中使用 resizeStack 处理程序编写脚本:

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
于 2013-07-09T05:29:40.117 回答
0

如果您正在做的事情是在调整堆栈窗口大小时将对象保持在所需的排列中,Monte 的答案是死的。但是,如果您想知道如何在卡片布局中调整或移动对象或对象组(您说“表单”,所以我假设这是一组对象)的大小或移动时保持相对定位,您只需在卡片布局中更新它用于调整表单或组大小的相同代码。

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

这是在 LiveCode 中维护布局的一般方法。

于 2013-07-09T15:08:05.960 回答