基于列表项的动态数字框在下面的脚本中,我有一个包含 3 个元素的列表,并且我试图创建一个新窗口,用户可以在其中为每个元素输入一些值:
myList = {"apple", "banana", "orange"};
nw = New Window( "Enter Numbers",
<<MODAL></MODAL>I use the for loop because the number of the items in the list "myList" changes. So that I would like to happen also for the Number Edit Boxes. However, I get back the following:
<SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Georgios_Tsim_0-1724768252918.png" style="width: 400px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Georgios_Tsim_0-1724768252918.png" style="width: 177px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Georgios_Tsim_0-1724768252918.png" style="width: 177px;"><span class="lia-inline-image-display-wrapper" image-alt="Georgios_Tsim_0-1724768252918.png" style="width: 177px;"><img src="https://us.v-cdn.net/6038925/uploads/images/67570iD9F0C812C0FDFAEA/Georgios_Tsim_0-1724768252918.png" role="button" title="Georgios_Tsim_0-1724768252918.png" alt="Georgios_Tsim_0-1724768252918.png" /></span></SPAN></SPAN></SPAN>
Ideally I would like the values that the end user enters to be saved in a list.
<LINGO-LABS id="lingo-labs-785852" slang="en-US" mode="CREATE"><LINGO-LABEL>自动化和脚本</LINGO-LABEL></LINGO-LABS>回复:基于列表项的动态数字框以下是我将采取的方法
Names Default To Here( 1 );
myList = {"apple", "banana", "orange"};
myVList = V List Box(
Text Box( "Enter the values" ),
lub = Lineup Box( N Col( 2 ), ),
H List Box( Button Box( "OK" ), Button Box( "Cancel" ) )
);
For Each( {box}, myList,
lub << append( Text Box( Eval( box ) ) );
lub << append( Number Edit Box( 42 ) );
);
nw = New Window( "Enter Numbers",
<<MODAL></MODAL>
<P><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1724769101857.png" style="width: 400px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="txnelson_0-1724769101857.png" style="width: 152px;"><span class="lia-inline-image-display-wrapper" image-alt="txnelson_0-1724769101857.png" style="width: 152px;"><img src="https://us.v-cdn.net/6038925/uploads/images/67571i70B066AB4D35A5C0/txnelson_0-1724769101857.png" role="button" title="txnelson_0-1724769101857.png" alt="txnelson_0-1724769101857.png" /></span></SPAN></SPAN></P>
<P> </P>回复:基于列表项的动态数字框您可以通过多种不同的方式来实现此目的。
您可以使用不同的方法来收集结果,您可以使用 XPath
Names Default To Here(1);
fruits = {"apple", "banana", "orange"};
value_collector = V List Box(
Text Box("Enter the values"),
lub = Lineup Box(N Col(2))
);
For Each({fruit}, fruits,
lub << append(Text Box(fruit));
lub << append(Number Edit Box(42));
);
nw = New Window("Enter Numbers", <<MODAL></MODAL>
<P>或者将引用存储到列表中</P>
<P> </P>
<P> </P>
<CODE class=" language-jsl">Names Default To Here(1);
fruits = {"apple", "banana", "orange"};
value_collector = V List Box(
Text Box("Enter the values"),
lub = Lineup Box(N Col(2))
);
nebs = {};
For Each({fruit}, fruits,
lub << append(Text Box(fruit));
lub << append(neb = Number Edit Box(42));
Insert Into(nebs, neb);
);
nw = New Window("Enter Numbers", <<MODAL></MODAL>
<P>或关联数组</P>
<P> </P>
<CODE class=" language-jsl">Names Default To Here(1);
fruits = {"apple", "banana", "orange"};
value_collector = V List Box(
Text Box("Enter the values"),
lub = Lineup Box(N Col(2))
);
vals = Associative Array();
For Each({fruit}, fruits,
lub << append(Text Box(fruit));
lub << append(neb = Number Edit Box(42));
vals[fruit] = neb;
);
nw = New Window("Enter Numbers", <<MODAL></MODAL>
<P>有了这些,你将拥有类似这样的用户界面</P>
<P><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1724770118276.png" style="width: 400px;"><span class="lia-inline-image-display-wrapper" image-alt="jthi_1-1724770118276.png" style="width: 175px;"><img src="https://us.v-cdn.net/6038925/uploads/images/67574i33AD25CCD1BE26A1/jthi_1-1724770118276.png" role="button" title="jthi_1-1724770118276.png" alt="jthi_1-1724770118276.png" /></span></SPAN></P>
<P>或者您可以使用完全不同的显示框元素(表格框和数字列编辑框)</P>
<CODE class=" language-jsl">Names Default To Here(1);
fruits = {"apple", "banana", "orange"};
nw = New Window("Enter Numbers", <<MODAL></MODAL>
<P><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1724770072443.png" style="width: 400px;"><span class="lia-inline-image-display-wrapper" image-alt="jthi_0-1724770072443.png" style="width: 159px;"><img src="https://us.v-cdn.net/6038925/uploads/images/67573i6DD519A3AA61CFB2/jthi_0-1724770072443.png" role="button" title="jthi_0-1724770072443.png" alt="jthi_0-1724770072443.png" /></span></SPAN></P>
<P> </P>