List box widgets show a list of options from which the user can choose one or several options. The list box widget is located in the Forms section of the Default widget library.
列表框部件显示选项列表,用户可以从中选择一个或多个选项。 列表框部件位于默认元件库的表单部分中。
Adding, Removing, and Reordering List Box Options添加、删除和重新排序列表框选项
To add and edit options in a list box, double-click the list box widget on the canvas or in the Outline pane to open the Edit List Box dialog. You can add a single option to the list box by clicking Add and typing the text of the new option in the field that appears. Alternatively, you can add several new options to the list box at once by clicking Edit Many.
要在列表框中添加和编辑选项,请双击画布或概要窗格中的列表框部件打开编辑列表框对话框。 你可以通过单击添加,然后在出现的字段中键入新选项的文本,将单个选项添加到列表框中。 或者,你以通过单击编辑多项一次将几个新选项添加到列表框中。
To reorder the list box options, select an option and use the Up and Down buttons at the top of the dialog. To delete an option, select it and click Delete, or click Edit Many and clear the text area to delete all the options at once.
要对列表框选项重新排序,请选择一个选项,然后使用对话框顶部的向上和向下按钮。 要删除选项,请选择它并单击删除,或单击编辑多项并清除文本区域以一次删除所有选项。
Allow Multiple Selections允许选择多个
The list box can allow for multiple selections, but you must first enable this setting. To allow multiple selections, double-click the list box and check Allow multiple items to be selected by default at the bottom of the Edit List Box dialog.
列表框可以允许选择多个,但是你必须首先启用此设置。 要允许选择多个,请双击列表框,然后在【编辑列表框】对话框的底部选中默认情况下允许选择多个项目。
Once this setting is enabled, you can select multiple options in the web browser by holding CTRL or CMD while clicking on several options.
启用此设置后,可以在Web浏览器中通过按住CTRL或CMD并单击多个选项来选择多个选项。
Defining a Default Option定义默认选项
Normally, a list box doesn't have any of its options selected by default in the web browser, but you can change this in the Edit List Box dialog. Double-click the list box widget and then check the box next to one of the options in the dialog.通常,列表框默认情况下不会在Web浏览器中选择任何选项,但是你可以在编辑列表框对话框中进行更改。 双击列表框部件,然后选中对话框中选项旁边的框。
|
Special Properties特殊属性
Disabled禁用
Disabling a list box prevents users from interacting with it in the web browser. This also activates the widget's Disabled style effect, making it appear greyed-out.
禁用列表框可防止用户在Web浏览器中与其进行交互。 这也会激活元件的:禁用样式效果,使其显示为灰色。
There are two ways to disable a widget:
禁用元件有两种方法:
Check the Disabled checkbox at the bottom of the Interactions pane.选中交互窗格的更多属性菜单中的禁用复选框。
Disable the widget dynamically in the web browser with the Enable/Disable action. You can do this as part of any interaction, such as when the page loads or when a button is clicked.通过启用/禁用操作在Web浏览器中动态禁用部件。 你可以在任何交互过程中执行此操作,例如在页面加载时或单击按钮时。
Tip提示
You can dynamically enable a disabled widget in the web browser with the Enable/Disable action. Check out the Terms and Conditions tutorial for an example of how this can be done.
你可以使用“启用/禁用”操作在Web浏览器中动态启用/禁用部件。 请查看【条款和条件】教程,以获取有关如何完成此操作的示例。
Special Interactions特殊交互
Selecting List Options选择列表选项
In the web browser, you can click a list box option to select it. If you have enabled multiple selections, you can hold CTRL or CMD while clicking to select multiple options.
在Web浏览器中,你可以单击列表框选项以将其选中。 如果启用了多个选择,则可以按住CTRL或CMD,同时单击以选择多个选项。
You can also dynamically change the selected option in a list box with the Set Selected List Option action. You can choose a specific list option or use a variable value to set the new selected option. (See limitations below.)
你还可以使用设置选定的列表选项操作动态地更改列表框中的选定选项。 你可以选择特定的列表选项,也可以使用变量值来设置新的选定选项。 (请参阅下面的限制。)
Capturing and Evaluating the Selected Option获取所选选项
You can access the selected option of a list box via the selected option of value option in interactions and conditions. For example, you can set the value of a global variable to the selected option of a list box in order to carry that value over to a different page. You can also evaluate a list box's selected option in a condition to only execute a certain case if the option matches a particular value. (See limitations below.)
你可以通过交互条件中的值选项的选中选项访问列表框的选中选项。 例如,你可以将全局变量的值设置为列表框的选定选项,以便将该值传递到另一个页面。 你还可以在条件下获取列表框的选中选项,以仅在选项与特定值匹配时才执行特定情况。 (请参阅下面的限制。)
Submit Button提交按钮
Pressing the ENTER key while a list box has focus in the web browser can fire the Click or Tap event of another widget on the page, known as the list box's "submit button."
当列表框在Web浏览器中处于焦点状态时,按ENTER键可以触发页面上另一个部件的点击事件,称为列表框的提交按钮。
To assign a submit button to a list box:
要将提交按钮分配给列表框:
Select the list box and click Show All in the lower section of the Interactions pane.选择列表框,然后单击“交互”窗格下部的“显示全部”。
Choose from a list of eligible widgets in the Submit Button dropdown.从“提交按钮”下拉列表中的可选部件列表中进行选择。
To unassign the submit button, click Unassign Submit Button at the bottom of the dropdown.
要取消分配提交按钮,请单击下拉列表底部的取消分配提交按钮。
Limitations and Workarounds局限性和解决办法
Dynamically Adding and Removing List Box Options动态添加和删除列表选项
The options available in a list box cannot be dynamically altered in the web browser, but you can simulate the effect by making a dynamic panel with multiple states, each containing a list box with different contents. When you want the options in your list box to change, switch the dynamic panel's state.
列表框中可用的选项无法在Web浏览器中动态更改,但是你可以通过制作具有多个状态的动态面板来模拟效果,每个面板都包含一个具有不同内容的列表框。 如果要更改列表框中的选项,请切换动态面板的状态。
Set or Read Multiple Selections设置或读取多个选择
When dynamically setting the selected option of a list box with the Set Selected List Option action, you can only select one option; it isn't possible to simultaneously select multiple options via an interaction.
通过设置选中列表选项操作动态设置列表框的选中选项时,你只能选择一个选项;你无法通过互动同时选择多个选项。
Similarly, only one selected option (the topmost one) can be read from a list box via the selected option of value option in interactions and conditions, even if multiple options have been selected.
同样,即使已选择多个选项,也只能通过交互和条件中的值选项的所选选项从列表框中读取一个所选选项(最顶部的选项)。
To work around these limitations, make a custom list box with shape widgets.
要解决这些限制,请制作一个带有形状部件的自定义列表框。
Tab Order制表顺序
Tab order for list boxes and other form widgets is determined by their layer depth, as shown in the Outline pane. You can learn more about this and how to change a widget's tab order in the Organizing Widgets article.
列表框和其他表单部件的制表顺序由其层深度确定,如概要窗格中所示。 你可以在管理元件文章中了解有关此内容以及如何更改部件制表顺序的更多信息。