Button 如何获取按钮标签文本的宽度?

Button 如何获取按钮标签文本的宽度?,button,width,livecode,Button,Width,Livecode,如何将脚本中创建的按钮的宽度设置为其标签文本的宽度 on createButtonWithLabel aLabel create button set the label of it to aLabel -- set the width of the button to the space used by 'aLabel' -- ?? end createButtonWithLabel 在LiveCode字典中搜索width会找到十几个条目,但似乎没有适用的条目。尝试以

如何将脚本中创建的按钮的宽度设置为其标签文本的宽度

on createButtonWithLabel aLabel
   create button
   set the label of it to aLabel
   -- set the width of the button to the space used by 'aLabel'
   -- ??
end createButtonWithLabel
在LiveCode字典中搜索width会找到十几个条目,但似乎没有适用的条目。

尝试以下方法:

将按钮“yourButton”的宽度设置为按钮“yourButton”的格式化宽度

克雷格·纽曼试试这个:

将按钮“yourButton”的宽度设置为按钮“yourButton”的格式化宽度


克雷格·纽曼(Craig Newman)

工作完美!谢谢,很好用!非常感谢。