为什么复选框大小时复选框不移动?

时间:2013-12-11 00:22:11

标签: livecode

我创建了一个堆栈,显示在调整堆栈大小时更改宽度的文本行。 “类别”列正在更改其调整大小的位置,但复选框不会。

我在代码中缺少什么?必须做出哪些改变?

请参阅可在此处下载的堆栈中的代码: https://dl.dropboxusercontent.com/u/99863601/Data%20grid%20Form-variable%20line%20height%2Bcheckbox.zip

提前致谢。

keram

2 个答案:

答案 0 :(得分:0)

因为DataGrid没有此功能。如果您使用几何管理器,则GM模板不会从模板中的复选框复制到实际DG中的复选框。因此,通用汽车将无法运作。也许您可以编写自己的脚本,将所有复选框的权限设置为相对于卡片宽度的位置:

on resizeStack
  lock screen
  repeat with x = 1 to number of buttons
    if the style of btn x is "checkbox" then
      set the right of btn x to the width of this cd - 100
    end if
  end repeat
  unlock screen
end resizeStack

不幸的是,这对数据网格也不起作用,因为DG也会对其自身进行一些(或很多)调整。

创建自己的内容要容易得多。

答案 1 :(得分:0)

如果我理解您要在此处实现的目标,那么在LayoutControl处理程序中进行以下更改:

 --   put the rect of btn "btnCheck" of me into theFieldRect
 --   put item 3 of pControlRect - 5 into item 3 of theFieldRect
 --   set the rect of btn "btnCheck" of me to theFieldRect
 set the left of btn "btnCheck" of me to the right of fld "cat" of me

但是我认为Cat领域的大小调整也是错误的。尝试类似:

on LayoutControl pControlRect
   set the right of btn "btnCheck" of me to item 3 of pControlRect-4
   set the right of fld "Cat" of me to the left of btn "btnCheck" of me
   get the rect of fld "Line" of me
   put the left of fld "Cat" of me into item 3 of it
   set the rect of fld "Line" of me to it
   put the formattedHeight of fld "Line" of me + item 2 of it into item 4 of it
   set the rect of fld "Line" of me to it
   put item 4 of it into item 4 of pControlRect
   set the rect of graphic "Background" of me to pControlRect
end LayoutControl

要编辑LayoutControl脚本,您需要打开datagrid属性检查器并单击Row Behavior ...按钮。这将显示行模板行为的脚本编辑器。