动态代码重复命令

时间:2015-03-31 19:45:17

标签: livecode

我有波纹管代码,我想完成以下内容 我有一个有一些领域的小组 我有2个变量。变量1,其中包含字段中的名称,变量2中包含值 我想将组中字段的文本设置为变量2 Var 1的第1行=字段名1 - Var 2第1行=值
Var 1的第2行=字段名2 - Var 2第2行=值

repeat with x=1 to the number of flds of grp "flds_grp"
          add 1 to counter
          put the short name of  fld x & cr after fldNames
     end repeat

     set the itemdel to comma
     put 0 into myCounter
     repeat for each line f in fldNames
          repeat for each line t in tvalues



          end repeat
     end repeat

2 个答案:

答案 0 :(得分:0)

你有一个变量counter,但似乎你不需要这个变量。

要将字段f的文本设置为变量t的值,请使用以下语法:

set the text of field f to t

答案 1 :(得分:0)

Livecode论坛中的Sparkout已经回答了正确的方法。

repeat with x=1 to the number of flds of group "grp-A"
   put line x of tValues into field x of group "grp-A"
end repeat