Struct ItemList

Control that provides a list of selectable items (and/or icons) in a single column, or optionally in multiple columns.

struct ItemList ;

This control provides a selectable list of items that may be in a single (or multiple columns) with option of text, icons, or both text and 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 constant ICON_MODE_TOP mode, but column's width is adjusted to fully fit its content by default. You need to set fixedColumnWidth greater than zero to wrap the text.

Properties

NameTypeDescription
allowReselect[get, set] boolIf true, the currently selected item can be selected again.
allowRmbSelect[get, set] boolIf true, right mouse button click can select items.
autoHeight[get, set] boolIf true, the control will automatically resize the height to fit its content.
fixedColumnWidth[get, set] longThe 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.
fixedIconSize[get, set] Vector2The size all icons will be adjusted to. If either X or Y component is not greater than zero, icon size won't be affected.
iconMode[get, set] ItemList.IconModeThe icon position, whether above or to the left of the text. See the iconmode constants.
iconScale[get, set] doubleThe scale of icon applied after fixedIconSize and transposing takes effect.
items[get, set] Array
maxColumns[get, set] longMaximum 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.
maxTextLines[get, set] longMaximum 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 iconMode is constant ICON_MODE_TOP. To make the text wrap, fixedColumnWidth should be greater than zero.
sameColumnWidth[get, set] boolWhether all columns will have the same width. If true, the width is equal to the largest column width of all columns.
selectMode[get, set] ItemList.SelectModeAllows single or multiple item selection. See the selectmode constants.

Methods

NameDescription
_getItems
_guiInput
_scrollChanged
_setItems
addIconItem Adds an item to the item list with no text, only an icon.
addItem Adds an item to the item list with specified text. 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.
clear Removes all items from the list.
ensureCurrentIsVisible Ensure current selection is visible, adjusting the scroll position as necessary.
getAllowReselect
getAllowRmbSelect
getFixedColumnWidth
getFixedIconSize
getIconMode
getIconScale
getItemAtPosition 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.
getItemCount Returns the number of items currently in the list.
getItemCustomBgColor Returns the custom background color of the item specified by idx index.
getItemCustomFgColor Returns the custom foreground color of the item specified by idx index.
getItemIcon Returns the icon associated with the specified index.
getItemIconModulate Returns a Color modulating item's icon at the specified index.
getItemIconRegion Returns the region of item's icon used. The whole icon will be used if the region has no area.
getItemMetadata Returns the metadata value of the specified index.
getItemText Returns the text associated with the specified index.
getItemTooltip Returns the tooltip hint associated with the specified index.
getMaxColumns
getMaxTextLines
getSelectedItems Returns an array with the indexes of the selected items.
getSelectMode
getVScroll Returns the GodotObject ID associated with the list.
hasAutoHeight
isAnythingSelected Returns true if one or more items are selected.
isItemDisabled Returns true if the item at the specified index is disabled.
isItemIconTransposed Returns true if the item icon will be drawn transposed, i.e. the X and Y axes are swapped.
isItemSelectable Returns true if the item at the specified index is selectable.
isItemTooltipEnabled Returns true if the tooltip is enabled for specified item index.
isSameColumnWidth
isSelected Returns true if the item at the specified index is currently selected.
moveItem Moves item from index from_idx to to_idx.
removeItem Removes the item specified by idx index from the list.
select Select the item at the specified index. Note: This method does not trigger the item selection signal.
setAllowReselect
setAllowRmbSelect
setAutoHeight
setFixedColumnWidth
setFixedIconSize
setIconMode
setIconScale
setItemCustomBgColor Sets the background color of the item specified by idx index to the specified Color.
setItemCustomFgColor Sets the foreground color of the item specified by idx index to the specified Color.
setItemDisabled 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).
setItemIcon Sets (or replaces) the icon's Texture associated with the specified index.
setItemIconModulate Sets a modulating Color of the item associated with the specified index.
setItemIconRegion Sets the region of item's icon used. The whole icon will be used if the region has no area.
setItemIconTransposed Sets whether the item icon will be drawn transposed.
setItemMetadata Sets a value (of any type) to be stored with the item associated with the specified index.
setItemSelectable Allows or disallows selection of the item associated with the specified index.
setItemText Sets text of the item associated with the specified index.
setItemTooltip Sets the tooltip hint for the item associated with the specified index.
setItemTooltipEnabled Sets whether the tooltip hint is enabled for specified item index.
setMaxColumns
setMaxTextLines
setSameColumnWidth
setSelectMode
sortItemsByText Sorts items in the list by their text.
unselect Ensures the item associated with the specified index is not selected.
unselectAll Ensures there are no items selected.

Enums

NameDescription
Constants
IconMode
SelectMode