基於清單項目的動態數字框在下面的腳本中,我有一個包含 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>有了這些,你將擁有像這樣的 UI</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>