Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AnimationMixer (2)
- AudioStreamPlayer
- CanvasItem (2)
- CanvasLayer (1)
- EditorFileSystem
- EditorPlugin (1)
- EditorResourcePreview
- HTTPRequest
- InstancePlaceholder
- MissingNode
- MultiplayerSpawner
- MultiplayerSynchronizer
- NavigationAgent2D
- NavigationAgent3D
- Node3D (31)
- ResourcePreloader
- ShaderGlobalsOverride
- StatusIndicator
- Timer
- Viewport (2)
- WorldEnvironment
- BaseButton (3)
- ColorRect
- Container (13)
- GraphEdit
- ItemList
- Label
- LineEdit
- MenuBar
- NinePatchRect
- Panel
- Range (6)
- ReferenceRect
- RichTextLabel
- Separator (2)
- TabBar
- TextEdit (1)
- TextureRect
- Tree
- VideoStreamPlayer
Table of contents
-
var allow_reselect: bool = false -
var allow_rmb_select: bool = false -
var allow_search: bool = true -
var auto_height: bool = false -
var auto_width: bool = false -
var clip_contents: bool = true -
var fixed_column_width: int = 0 -
var fixed_icon_size: Vector2i = Vector2i(0, 0) -
var focus_mode = FOCUS_ALL -
var icon_mode = ICON_MODE_LEFT -
var icon_scale: float = 1.0 -
var item_count: int = 0 -
var max_columns: int = 1 -
var max_text_lines: int = 1 -
var same_column_width: bool = false -
var select_mode = SELECT_SINGLE -
var text_overrun_behavior = OVERRUN_TRIM_ELLIPSIS -
var wraparound_items: bool = true -
func add_icon_item(selectable: bool = true) -> int -
func add_item(selectable: bool = true) -> int -
func clear() -> void -
func deselect(idx: int) -> void -
func deselect_all() -> void -
func ensure_current_is_visible() -> void -
func force_update_list_size() -> void -
func get_h_scroll_bar() -> HScrollBar -
const func get_item_at_position(exact: bool = false) -> int -
const func get_item_auto_translate_mode(idx: int) -> intNode.AutoTranslateMode -
const func get_item_custom_bg_color(idx: int) -> Color -
const func get_item_custom_fg_color(idx: int) -> Color -
const func get_item_icon(idx: int) -> Texture2D -
const func get_item_icon_modulate(idx: int) -> Color -
const func get_item_icon_region(idx: int) -> Rect2 -
const func get_item_language(idx: int) -> String -
const func get_item_metadata(idx: int) -> Variant -
const func get_item_rect(expand: bool = true) -> Rect2 -
const func get_item_text(idx: int) -> String -
const func get_item_text_direction(idx: int) -> intControl.TextDirection -
const func get_item_tooltip(idx: int) -> String -
func get_selected_items() -> PackedInt32Array -
func get_v_scroll_bar() -> VScrollBar -
func is_anything_selected() -> bool -
const func is_item_disabled(idx: int) -> bool -
const func is_item_icon_transposed(idx: int) -> bool -
const func is_item_selectable(idx: int) -> bool -
const func is_item_tooltip_enabled(idx: int) -> bool -
const func is_selected(idx: int) -> bool -
func move_item(to_idx: int) -> void -
func remove_item(idx: int) -> void -
func select(single: bool = true) -> void -
func set_item_auto_translate_mode(mode: int enumNode.AutoTranslateMode) -> void -
func set_item_custom_bg_color(custom_bg_color: Color) -> void -
func set_item_custom_fg_color(custom_fg_color: Color) -> void -
func set_item_disabled(disabled: bool) -> void -
func set_item_icon(icon: Texture2D) -> void -
func set_item_icon_modulate(modulate: Color) -> void -
func set_item_icon_region(rect: Rect2) -> void -
func set_item_icon_transposed(transposed: bool) -> void -
func set_item_language(language: String) -> void -
func set_item_metadata(metadata: Variant) -> void -
func set_item_selectable(selectable: bool) -> void -
func set_item_text(text: String) -> void -
func set_item_text_direction(direction: int enumControl.TextDirection) -> void -
func set_item_tooltip(tooltip: String) -> void -
func set_item_tooltip_enabled(enable: bool) -> void -
func sort_items_by_text() -> void -
const ICON_MODE_TOP = 0 enum IconMode -
const ICON_MODE_LEFT = 1 enum IconMode -
const SELECT_SINGLE = 0 enum SelectMode -
const SELECT_MULTI = 1 enum SelectMode -
const SELECT_TOGGLE = 2 enum SelectMode -
enum IconMode -
enum SelectMode -
signal empty_clicked(mouse_button_index: int) -
signal item_activated(index: int) -
signal item_clicked(mouse_button_index: int) -
signal item_selected(index: int) -
signal multi_selected(selected: bool) -
self["theme_override_colors/font_color"] = Color(0.65, 0.65, 0.65, 1) as Color -
self["theme_override_colors/font_hovered_color"] = Color(0.95, 0.95, 0.95, 1) as Color -
self["theme_override_colors/font_hovered_selected_color"] = Color(1, 1, 1, 1) as Color -
self["theme_override_colors/font_outline_color"] = Color(0, 0, 0, 1) as Color -
self["theme_override_colors/font_selected_color"] = Color(1, 1, 1, 1) as Color -
self["theme_override_colors/guide_color"] = Color(0.7, 0.7, 0.7, 0.25) as Color -
self["theme_override_constants/h_separation"] = 4 as int -
self["theme_override_constants/icon_margin"] = 4 as int -
self["theme_override_constants/line_separation"] = 2 as int -
self["theme_override_constants/outline_size"] = 0 as int -
self["theme_override_constants/v_separation"] = 4 as int -
self["theme_override_fonts/font"] = font as Font -
self["theme_override_font_sizes/font_size"] = font_size as int -
self["theme_override_styles/cursor"] = style as StyleBox -
self["theme_override_styles/cursor_unfocused"] = style as StyleBox -
self["theme_override_styles/focus"] = style as StyleBox -
self["theme_override_styles/hovered"] = style as StyleBox -
self["theme_override_styles/hovered_selected"] = style as StyleBox -
self["theme_override_styles/hovered_selected_focus"] = style as StyleBox -
self["theme_override_styles/panel"] = style as StyleBox -
self["theme_override_styles/selected"] = style as StyleBox -
self["theme_override_styles/selected_focus"] = style as StyleBox
ItemList #
is_instantiable, Node, core, not_builtin_classes
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.
Members #
var allow_reselect: bool = false#
If true, the currently selected item can be selected again.
var allow_rmb_select: bool = false#
If true, right mouse button click can select items.
var allow_search: bool = true#
If true, allows navigating the ItemList with letter keys through incremental search.
var auto_height: bool = false#
If true, the control will automatically resize the height to fit its content.
var auto_width: bool = false#
If true, the control will automatically resize the width to fit its content.
var clip_contents: bool = true#
var fixed_column_width: int = 0#
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.
var fixed_icon_size: Vector2i = Vector2i(0, 0)#
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.
var focus_mode = FOCUS_ALL#
var icon_mode = ICON_MODE_LEFT#
The icon position, whether above or to the left of the text. See the IconMode constants.
var icon_scale: float = 1.0#
The scale of icon applied after fixed_icon_size and transposing takes effect.
var item_count: int = 0#
The number of items currently in the list.
var max_columns: int = 1#
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.
var max_text_lines: int = 1#
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.
var same_column_width: bool = false#
Whether all columns will have the same width.
If true, the width is equal to the largest column width of all columns.
var select_mode = SELECT_SINGLE#
Allows single or multiple item selection. See the SelectMode constants.
var text_overrun_behavior = OVERRUN_TRIM_ELLIPSIS#
Sets the clipping behavior when the text exceeds an item's bounding rectangle. See TextServer.OverrunBehavior for a description of all modes.
var wraparound_items: bool = true#
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.
Methods #
func add_icon_item(selectable: bool = true) -> int#
Adds an item to the item list with no text, only an icon. Returns the index of an added item.
func add_item(selectable: bool = true) -> int#
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.
func clear() -> void#
Removes all items from the list.
func deselect(idx: int) -> void#
Ensures the item associated with the specified index is not selected.
func deselect_all() -> void#
Ensures there are no items selected.
func ensure_current_is_visible() -> void#
Ensure current selection is visible, adjusting the scroll position as necessary.
func force_update_list_size() -> void#
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.
func get_h_scroll_bar() -> HScrollBar#
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.
const func get_item_at_position(exact: bool = false) -> int#
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.
const func get_item_auto_translate_mode(idx: int) -> intNode.AutoTranslateMode#
Returns item's auto translate mode.
const func get_item_custom_bg_color(idx: int) -> Color#
Returns the custom background color of the item specified by idx index.
const func get_item_custom_fg_color(idx: int) -> Color#
Returns the custom foreground color of the item specified by idx index.
const func get_item_icon(idx: int) -> Texture2D#
Returns the icon associated with the specified index.
const func get_item_icon_modulate(idx: int) -> Color#
Returns a Color modulating item's icon at the specified index.
const func get_item_icon_region(idx: int) -> Rect2#
Returns the region of item's icon used. The whole icon will be used if the region has no area.
const func get_item_language(idx: int) -> String#
Returns item's text language code.
const func get_item_metadata(idx: int) -> Variant#
Returns the metadata value of the specified index.
const func get_item_rect(expand: bool = true) -> Rect2#
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.
const func get_item_text(idx: int) -> String#
Returns the text associated with the specified index.
const func get_item_text_direction(idx: int) -> intControl.TextDirection#
Returns item's text base writing direction.
const func get_item_tooltip(idx: int) -> String#
Returns the tooltip hint associated with the specified index.
func get_selected_items() -> PackedInt32Array#
Returns an array with the indexes of the selected items.
func get_v_scroll_bar() -> VScrollBar#
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.
func is_anything_selected() -> bool#
Returns true if one or more items are selected.
const func is_item_disabled(idx: int) -> bool#
Returns true if the item at the specified index is disabled.
const func is_item_icon_transposed(idx: int) -> bool#
Returns true if the item icon will be drawn transposed, i.e. the X and Y axes are swapped.
const func is_item_selectable(idx: int) -> bool#
Returns true if the item at the specified index is selectable.
const func is_item_tooltip_enabled(idx: int) -> bool#
Returns true if the tooltip is enabled for specified item index.
const func is_selected(idx: int) -> bool#
Returns true if the item at the specified index is currently selected.
func move_item(to_idx: int) -> void#
Moves item from index from_idx to to_idx.
func remove_item(idx: int) -> void#
Removes the item specified by idx index from the list.
func select(single: bool = true) -> void#
Select the item at the specified index.
Note: This method does not trigger the item selection signal.
func set_item_auto_translate_mode(mode: int enumNode.AutoTranslateMode) -> void#
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.
func set_item_custom_bg_color(custom_bg_color: Color) -> void#
Sets the background color of the item specified by idx index to the specified Color.
func set_item_custom_fg_color(custom_fg_color: Color) -> void#
Sets the foreground color of the item specified by idx index to the specified Color.
func set_item_disabled(disabled: bool) -> void#
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).
func set_item_icon(icon: Texture2D) -> void#
Sets (or replaces) the icon's Texture2D associated with the specified index.
func set_item_icon_modulate(modulate: Color) -> void#
Sets a modulating Color of the item associated with the specified index.
func set_item_icon_region(rect: Rect2) -> void#
Sets the region of item's icon used. The whole icon will be used if the region has no area.
func set_item_icon_transposed(transposed: bool) -> void#
Sets whether the item icon will be drawn transposed.
func set_item_language(language: String) -> void#
Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
func set_item_metadata(metadata: Variant) -> void#
Sets a value (of any type) to be stored with the item associated with the specified index.
func set_item_selectable(selectable: bool) -> void#
Allows or disallows selection of the item associated with the specified index.
func set_item_text(text: String) -> void#
Sets text of the item associated with the specified index.
func set_item_text_direction(direction: int enumControl.TextDirection) -> void#
Sets item's text base writing direction.
func set_item_tooltip(tooltip: String) -> void#
Sets the tooltip hint for the item associated with the specified index.
func set_item_tooltip_enabled(enable: bool) -> void#
Sets whether the tooltip hint is enabled for specified item index.
func sort_items_by_text() -> void#
Sorts items in the list by their text.
Annotations #
Constants #
const ICON_MODE_TOP = 0 enum IconMode#
Icon is drawn above the text.
const ICON_MODE_LEFT = 1 enum IconMode#
Icon is drawn to the left of the text.
const SELECT_SINGLE = 0 enum SelectMode#
Only allow selecting a single item.
const SELECT_MULTI = 1 enum SelectMode#
Allows selecting multiple items by holding Ctrl or Shift.
const SELECT_TOGGLE = 2 enum SelectMode#
Allows selecting multiple items by toggling them on and off.
Constructors #
Enums #
IconMode#
enum IconMode {
ICON_MODE_TOP = 0,
ICON_MODE_LEFT = 1,
}SelectMode#
enum SelectMode {
SELECT_SINGLE = 0,
SELECT_MULTI = 1,
SELECT_TOGGLE = 2,
} Operators #
Signals #
signal empty_clicked(mouse_button_index: int)#
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.
signal item_activated(index: int)#
Emitted when specified list item is activated via double-clicking or by pressing Enter.
signal item_clicked(mouse_button_index: int)#
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.
signal item_selected(index: int)#
Emitted when specified item has been selected. Only applicable in single selection mode.
allow_reselect must be enabled to reselect an item.
signal multi_selected(selected: bool)#
Emitted when a multiple selection is altered on a list allowing multiple selection.
Theme Items #
self["theme_override_colors/font_color"] = Color(0.65, 0.65, 0.65, 1) as Color#
Default text Color of the item.
self["theme_override_colors/font_hovered_color"] = Color(0.95, 0.95, 0.95, 1) as Color#
Text Color used when the item is hovered and not selected yet.
self["theme_override_colors/font_hovered_selected_color"] = Color(1, 1, 1, 1) as Color#
Text Color used when the item is hovered and selected.
self["theme_override_colors/font_outline_color"] = Color(0, 0, 0, 1) as Color#
The tint of text outline of the item.
self["theme_override_colors/font_selected_color"] = Color(1, 1, 1, 1) as Color#
Text Color used when the item is selected, but not hovered.
self["theme_override_colors/guide_color"] = Color(0.7, 0.7, 0.7, 0.25) as Color#
Color of the guideline. The guideline is a line drawn between each row of items.
self["theme_override_constants/h_separation"] = 4 as int#
The horizontal spacing between items.
self["theme_override_constants/icon_margin"] = 4 as int#
The spacing between item's icon and text.
self["theme_override_constants/line_separation"] = 2 as int#
The vertical spacing between each line of text.
self["theme_override_constants/outline_size"] = 0 as int#
The size of the item text outline.
Note: If using a font with FontFile.multichannel_signed_distance_field enabled, its FontFile.msdf_pixel_range must be set to at least twice the value of outline_size for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
self["theme_override_constants/v_separation"] = 4 as int#
The vertical spacing between items.
self["theme_override_fonts/font"] = font as Font#
Font of the item's text.
self["theme_override_font_sizes/font_size"] = font_size as int#
Font size of the item's text.
self["theme_override_styles/cursor"] = style as StyleBox#
StyleBox used for the cursor, when the ItemList is being focused.
self["theme_override_styles/cursor_unfocused"] = style as StyleBox#
StyleBox used for the cursor, when the ItemList is not being focused.
self["theme_override_styles/focus"] = style as StyleBox#
The focused style for the ItemList, drawn on top of the background, but below everything else.
self["theme_override_styles/hovered"] = style as StyleBox#
StyleBox for the hovered, but not selected items.
self["theme_override_styles/hovered_selected"] = style as StyleBox#
StyleBox for the hovered and selected items, used when the ItemList is not being focused.
self["theme_override_styles/hovered_selected_focus"] = style as StyleBox#
StyleBox for the hovered and selected items, used when the ItemList is being focused.
self["theme_override_styles/panel"] = style as StyleBox#
The background style for the ItemList.
self["theme_override_styles/selected"] = style as StyleBox#
StyleBox for the selected items, used when the ItemList is not being focused.
self["theme_override_styles/selected_focus"] = style as StyleBox#
StyleBox for the selected items, used when the ItemList is being focused.