【发布时间】:2016-04-27 23:34:52
【问题描述】:
在 LiveCode 上的文本字段中,我想要两行单独的文本。应该是这样的:
句子的第一行
第二行句子
我该怎么做?
【问题讨论】:
标签: livecode
在 LiveCode 上的文本字段中,我想要两行单独的文本。应该是这样的:
句子的第一行
第二行句子
我该怎么做?
【问题讨论】:
标签: livecode
如果您手动输入文本,请键入回车键或回车键以将回车字符添加到文本字段。您也可以通过脚本来执行此操作。
使用cr 在文本字段中定义返回值。例如。如果您有一个包含一个字段的堆栈,请执行以下行将两行放入文本字段:
put "First line of sentence" & cr & "Second line of sentence" into field 1
例如,您可以将这一行包含在按钮的 mouseUp 处理程序中。
【讨论】:
您可以更进一步,更加熟悉 LC 所说的“块表达式”。假设您在某个字段中有一个句子。在按钮的脚本中考虑这一点:
on mouseUp
put return after word 3 of fld "yourField"
end mouseUp
现在试试这个:
on mouseUp
put return & return after word 3 of fld "yourField"
end mouseUp
【讨论】:
我想知道同样的事情,然后不断修补并发现“食谱”几乎可以肯定有更好的方法,但从逻辑上讲,这是我能想到的最好的方法。仍在学习文档,找不到待办事项列表示例。
on mouseUp
put the text of field"NewItem" into NewItem
put the text of field"GroceryList" into GroceryList
set the text of field"GroceryList" to empty
put GroceryList & return & NewItem into GroceryList
set the text of field "GroceryList" to GroceryList
set the text of field"NewItem" to empty
end mouseUp
【讨论】: