2013-07-08 28 views
2

如果是这样,怎么样? ...为了清楚起见,如果在窗体和对象的边之间有2个像素,并且调整窗体大小,我希望窗体和对象之间的距离在调整大小后仍然为2像素。LiveCode对象是否可以锚定到表单的一个或多个边?

谢谢,一如既往。

+0

该对象是否应该重新调整大小或重新定位? – splash21

+0

@ Splash21 - 我在考虑后者,但很好地了解这两者。 –

回答

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 
+0

这给了我需要的信息。谢谢。 (我想我已经被使用IDE和语言的特性为开发者做了很多这种工作而被宠坏了) –

0

蒙的回答是死的,如果你正在做的事情是保持对象在调整堆栈窗口大小时以所需的排列。但是,如果您想知道如何在调整大小或移动卡片布局中的对象或对象组(如您所说的“表格”,以便我假设这是一组对象)时保持相对位置,则只需在您使用相同的代码来调整表单或组的大小。

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中维护布局的一般方法。

相关问题