.. _stdlib_ui_dropdown_component: ========== UIDropdown ========== +++++++ Classes +++++++ .. _struct-ui_dropdown_component-UIDropDown: .. das:attribute:: UIDropDown : UIComponent A drop-down list component that can be used to select an item from a list. Usage example:: def init_dropdown() { get_component(node) $(var dropdown : UIDropDown?) { dropdown.items = ["Option 1", "Option 2", "Option 3"] dropdown.onChange = @(newIndex : int) { print("Selected index changed to {newIndex}") } } } :Fields: * **items** : array - List of items to display in the dropdown. * **dropdownNode** : :ref:`NodeId ` - Node for the dropdown list (should be a container node). * **textField** : :ref:`UIText ` ? - The text field component to display the selected item. * **itemPrefab** : :ref:`PrefabId ` - Prefab for the dropdown items (should have UIText and UIFrame components). * **onChange** : lambda<(index:int):void> - Called when the selection changes. .. _function-ui_dropdown_component_UIDropDown_rq_on_initialize_UIDropDown: .. das:function:: UIDropDown.on_initialize() Initializes the drop-down list and sets up button handlers. .. _function-ui_dropdown_component_UIDropDown_rq_on_update_UIDropDown: .. das:function:: UIDropDown.on_update() Updates the drop-down list if the items have changed. .. _function-ui_dropdown_component_UIDropDown_rq_select_UIDropDown_int_bool: .. das:function:: UIDropDown.select(newIndex: int; doFade: bool) Sets the selected index and updates UI. :Arguments: * **newIndex** : int * **doFade** : bool .. _function-ui_dropdown_component_UIDropDown_rq_invalidate_UIDropDown_bool: .. das:function:: UIDropDown.invalidate(doFade: bool) Updates the displayed selected item text. :Arguments: * **doFade** : bool .. _function-ui_dropdown_component_UIDropDown_rq_toggle_dropdown_UIDropDown: .. das:function:: UIDropDown.toggle_dropdown() Toggles the drop-down list open/closed. .. _function-ui_dropdown_component_UIDropDown_rq_open_dropdown_UIDropDown: .. das:function:: UIDropDown.open_dropdown() Opens the drop-down list. .. _function-ui_dropdown_component_UIDropDown_rq_close_dropdown_UIDropDown: .. das:function:: UIDropDown.close_dropdown() Closes the drop-down list. :Properties: .. _function-ui_dropdown_component__dot__rq_selectedIndex_UIDropDown: .. das:operator:: UIDropDown.selectedIndex() : int Returns the currently selected index. .. _function-ui_dropdown_component__dot__rq_selectedIndex_rq_clone_UIDropDown_int: .. das:operator:: UIDropDown.selectedIndex =(newIndex: int) Sets the selected index and updates UI. :Arguments: * **newIndex** : int .. _function-ui_dropdown_component__dot__rq_itemNodes_UIDropDown: .. das:operator:: UIDropDown.itemNodes() : array Returns the list of item nodes.