A vertical list of selectable items with one or multiple columns.
This control provides a vertical list of selectable items that may be in a single or in multiple columns, with each item having options for text and an icon. Tooltips are supported and may be different for every item in the list.
Selectable items in the list may be selected or deselected and multiple selection may be enabled. Selection with right mouse button may also be enabled to allow use of popup context menus. Items may also be "activated" by double-clicking them or by pressing Enter.
Item text only supports single-line strings. Newline characters (e.g. \n) in the string won't produce a newline. Text wrapping is enabled in ICON_MODE_TOP mode, but the column's width is adjusted to fully fit its content by default. You need to set fixed_column_width greater than zero to wrap the text.
All set_* methods allow negative item indices, i.e. -1 to access the last item, -2 to select the second-to-last item, and so on.
Incremental search: Like PopupMenu and Tree, ItemList supports searching within the list while the control is focused. Press a key that matches the first letter of an item's name to select the first item starting with the given letter. After that point, there are two ways to perform incremental search: 1) Press the same key again before the timeout duration to select the next item starting with the same letter. 2) Press letter keys that match the rest of the word before the timeout duration to match to select the item in question directly. Both of these actions will be reset to the beginning of the list if the timeout duration has passed since the last keystroke was registered. You can adjust the timeout duration by changing ProjectSettings.gui/timers/incremental_search_max_interval_msec.
If true, allows navigating the ItemList with letter keys through incremental search.
The width all columns will be adjusted to.
A value of zero disables the adjustment, each item will have a width equal to the width of its content and the columns will have an uneven width.
The size all icons will be adjusted to.
If either X or Y component is not greater than zero, icon size won't be affected.
The icon position, whether above or to the left of the text. See the IconMode constants.
The scale of icon applied after fixed_icon_size and transposing takes effect.
Maximum columns the list will have.
If greater than zero, the content will be split among the specified columns.
A value of zero means unlimited columns, i.e. all items will be put in the same row.
Maximum lines of text allowed in each item. Space will be reserved even when there is not enough lines of text to display.
Note: This property takes effect only when icon_mode is ICON_MODE_TOP. To make the text wrap, fixed_column_width should be greater than zero.
Whether all columns will have the same width.
If true, the width is equal to the largest column width of all columns.
The way which scroll hints (indicators that show that the content can still be scrolled in a certain direction) will be shown.
Allows single or multiple item selection. See the SelectMode constants.
If true, the scroll hint texture will be tiled instead of stretched. See scroll_hint_mode.
If true, the control will automatically move items into a new row to fit its content. See also HFlowContainer for this behavior.
If false, the control will add a horizontal scrollbar to make all items visible.
Adds an item to the item list with specified text. Returns the index of an added item.
Specify an icon, or use null as the icon for a list item with no icon.
If selectable is true, the list item will be selectable.
Ensures the currently selected item (the first selected item if multiple selection is enabled) is visible, adjusting the scroll position as necessary to place the item at the center of the list if possible. See also ensure_current_is_visible().
Fails and prints an error if both arguments are false.
Ensures the currently selected item (the first selected item if multiple selection is enabled) is visible, adjusting the scroll position as necessary. See also center_on_current().
Forces an update to the list size based on its items. This happens automatically whenever size of the items, or other relevant settings like auto_height, change. The method can be used to trigger the update ahead of next drawing pass.
Returns the horizontal scrollbar.
Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their CanvasItem.visible property.
Returns the item index at the given position.
When there is no item at that point, -1 will be returned if exact is true, and the closest item index will be returned otherwise.
Note: The returned value is unreliable if called right after modifying the ItemList, before it redraws in the next frame.
Returns a Color modulating item's icon at the specified index.
Returns the position and size of the item with the specified index, in the coordinate system of the ItemList node. If expand is true the last column expands to fill the rest of the row.
Note: The returned value is unreliable if called right after modifying the ItemList, before it redraws in the next frame.
Returns the vertical scrollbar.
Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their CanvasItem.visible property.
Selects the item at the specified index.
Note: This method does not trigger the item selection signal.
Sets the auto translate mode of the item associated with the specified index.
Items use Node.AUTO_TRANSLATE_MODE_INHERIT by default, which uses the same auto translate mode as the ItemList itself.
Sets the background color of the item specified by idx index to the specified Color.
Sets the foreground color of the item specified by idx index to the specified Color.
Disables (or enables) the item at the specified index.
Disabled items cannot be selected and do not trigger activation signals (when double-clicking or pressing Enter).
Sets (or replaces) the icon's Texture2D associated with the specified index.
Sets a modulating Color of the item associated with the specified index.
Sets the language code of the text for the item at the given index to language. This is used for line-breaking and text shaping algorithms. If language is empty, the current locale is used.
Emitted when any mouse click is issued within the rect of the list but on empty space.
at_position is the click position in this control's local coordinate system.
Emitted when specified list item has been clicked with any mouse button.
at_position is the click position in this control's local coordinate system.
Emitted when specified item has been selected. Only applicable in single selection mode.
allow_reselect must be enabled to reselect an item.
ICON_MODE_TOP = 0Icon is drawn above the text.
ICON_MODE_LEFT = 1Icon is drawn to the left of the text.