class-description NEWS COMMUNITY STORE TUTORIALS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE TUTORIALS TOGGLE FULLSCREEN VOLLBILD AN/AUS ObjectNodeCanvasItemControl ItemList
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 kbdEnter[/kbd].
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 [member ProjectSettings.gui/timers/incremental_search_max_interval_msec].
Enum IconMode<>():Enum

ICON_MODE_TOP:null = 0
Icon is drawn above the text.


ICON_MODE_LEFT:null = 1
Icon is drawn to the left of the text.
Enum SelectMode<>():Enum

SELECT_SINGLE:null = 0
Only allow selecting a single item.


SELECT_MULTI:null = 1
Allows selecting multiple items by holding kbdCtrl[/kbd] or kbdShift[/kbd].


SELECT_TOGGLE:null = 2
Allows selecting multiple items by toggling them on and off.
Signal empty_clicked<>( Vector2 at_position=, at_position:Vector2=, int mouse_button_index=, mouse_button_index:int=, ):Signal
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<>( int index=, index:int=, ):Signal
Emitted when specified list item is activated via double-clicking or by pressing kbdEnter[/kbd].

Signal item_clicked<>( int index=, index:int=, Vector2 at_position=, at_position:Vector2=, int mouse_button_index=, mouse_button_index:int=, ):Signal
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<>( int index=, index:int=, ):Signal
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<>( int index=, index:int=, bool selected=, selected:bool=, ):Signal
Emitted when a multiple selection is altered on a list allowing multiple selection.

set get bool allow_reselect<>():bool set get
If true, the currently selected item can be selected again.

set get bool allow_rmb_select<>():bool set get
If true, right mouse button click can select items.

set get bool allow_search<>():bool set get
If true, allows navigating the ItemList with letter keys through incremental search.

set get bool auto_height<>():bool set get
If true, the control will automatically resize the height to fit its content.

set get bool auto_width<>():bool set get
If true, the control will automatically resize the width to fit its content.

set get bool clip_contents<>():bool set get
set get int fixed_column_width<>():int set get
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.
set get Vector2i fixed_icon_size<>():Vector2i set get
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.
set get int focus_mode<>():int set get
set get int icon_mode<>():int set get
The icon position, whether above or to the left of the text. See the IconMode constants.

set get float icon_scale<>():float set get
The scale of icon applied after fixed_icon_size and transposing takes effect.

set get int item_count<>():int set get
The number of items currently in the list.

set get int max_columns<>():int set get
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.
set get int max_text_lines<>():int set get
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.
set get bool same_column_width<>():bool set get
Whether all columns will have the same width.

If true, the width is equal to the largest column width of all columns.
set get int select_mode<>():int set get
Allows single or multiple item selection. See the SelectMode constants.

set get int text_overrun_behavior<>():int set get
The clipping behavior when the text exceeds an item's bounding rectangle.

set get bool wraparound_items<>():bool set get
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.
int add_icon_item<>( Texture2D icon=, icon:Texture2D=, bool selectable=true, selectable:bool=true, ):int
Adds an item to the item list with no text, only an icon. Returns the index of an added item.

int add_item<>( String text=, text:String=, Texture2D icon=null, icon:Texture2D=null, bool selectable=true, 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.
void clear<>():void
Removes all items from the list.

void deselect<>( int idx=, idx:int=, ):void
Ensures the item associated with the specified index is not selected.

void deselect_all<>():void
Ensures there are no items selected.

void ensure_current_is_visible<>():void
Ensure current selection is visible, adjusting the scroll position as necessary.

void 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.

HScrollBar 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 [member CanvasItem.visible] property.
int get_item_at_position<>( Vector2 position=, position:Vector2=, bool exact=false, 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.
int get_item_auto_translate_mode<>( int idx=, idx:int=, ):int
Returns item's auto translate mode.

Color get_item_custom_bg_color<>( int idx=, idx:int=, ):Color
Returns the custom background color of the item specified by idx index.

Color get_item_custom_fg_color<>( int idx=, idx:int=, ):Color
Returns the custom foreground color of the item specified by idx index.

Texture2D get_item_icon<>( int idx=, idx:int=, ):Texture2D
Returns the icon associated with the specified index.

Color get_item_icon_modulate<>( int idx=, idx:int=, ):Color
Returns a Color modulating item's icon at the specified index.

Rect2 get_item_icon_region<>( int idx=, idx:int=, ):Rect2
Returns the region of item's icon used. The whole icon will be used if the region has no area.

String get_item_language<>( int idx=, idx:int=, ):String
Returns item's text language code.

Variant get_item_metadata<>( int idx=, idx:int=, ):Variant
Returns the metadata value of the specified index.

Rect2 get_item_rect<>( int idx=, idx:int=, bool expand=true, 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.
String get_item_text<>( int idx=, idx:int=, ):String
Returns the text associated with the specified index.

int get_item_text_direction<>( int idx=, idx:int=, ):int
Returns item's text base writing direction.

String get_item_tooltip<>( int idx=, idx:int=, ):String
Returns the tooltip hint associated with the specified index.

PackedInt32Array get_selected_items<>():PackedInt32Array
Returns an array with the indexes of the selected items.

VScrollBar 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 [member CanvasItem.visible] property.
bool is_anything_selected<>():bool
Returns true if one or more items are selected.

bool is_item_disabled<>( int idx=, idx:int=, ):bool
Returns true if the item at the specified index is disabled.

bool is_item_icon_transposed<>( int idx=, idx:int=, ):bool
Returns true if the item icon will be drawn transposed, i.e. the X and Y axes are swapped.

bool is_item_selectable<>( int idx=, idx:int=, ):bool
Returns true if the item at the specified index is selectable.

bool is_item_tooltip_enabled<>( int idx=, idx:int=, ):bool
Returns true if the tooltip is enabled for specified item index.

bool is_selected<>( int idx=, idx:int=, ):bool
Returns true if the item at the specified index is currently selected.

void move_item<>( int from_idx=, from_idx:int=, int to_idx=, to_idx:int=, ):void
Moves item from index from_idx to to_idx.

void remove_item<>( int idx=, idx:int=, ):void
Removes the item specified by idx index from the list.

void select<>( int idx=, idx:int=, bool single=true, single:bool=true, ):void
Select the item at the specified index.

Note: This method does not trigger the item selection signal.
void set_item_auto_translate_mode<>( int idx=, idx:int=, int mode=, mode:int=, ):void
Sets the auto translate mode of the item associated with the specified index.

Items use [constant Node.AUTO_TRANSLATE_MODE_INHERIT] by default, which uses the same auto translate mode as the ItemList itself.
void set_item_custom_bg_color<>( int idx=, idx:int=, Color custom_bg_color=, custom_bg_color:Color=, ):void
Sets the background color of the item specified by idx index to the specified Color.

void set_item_custom_fg_color<>( int idx=, idx:int=, Color custom_fg_color=, custom_fg_color:Color=, ):void
Sets the foreground color of the item specified by idx index to the specified Color.

void set_item_disabled<>( int idx=, idx:int=, bool 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 kbdEnter[/kbd]).
void set_item_icon<>( int idx=, idx:int=, Texture2D icon=, icon:Texture2D=, ):void
Sets (or replaces) the icon's Texture2D associated with the specified index.

void set_item_icon_modulate<>( int idx=, idx:int=, Color modulate=, modulate:Color=, ):void
Sets a modulating Color of the item associated with the specified index.

void set_item_icon_region<>( int idx=, idx:int=, Rect2 rect=, rect:Rect2=, ):void
Sets the region of item's icon used. The whole icon will be used if the region has no area.

void set_item_icon_transposed<>( int idx=, idx:int=, bool transposed=, transposed:bool=, ):void
Sets whether the item icon will be drawn transposed.

void set_item_language<>( int idx=, idx:int=, String 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.

void set_item_metadata<>( int idx=, idx:int=, Variant metadata=, metadata:Variant=, ):void
Sets a value (of any type) to be stored with the item associated with the specified index.

void set_item_selectable<>( int idx=, idx:int=, bool selectable=, selectable:bool=, ):void
Allows or disallows selection of the item associated with the specified index.

void set_item_text<>( int idx=, idx:int=, String text=, text:String=, ):void
Sets text of the item associated with the specified index.

void set_item_text_direction<>( int idx=, idx:int=, int direction=, direction:int=, ):void
Sets item's text base writing direction.

void set_item_tooltip<>( int idx=, idx:int=, String tooltip=, tooltip:String=, ):void
Sets the tooltip hint for the item associated with the specified index.

void set_item_tooltip_enabled<>( int idx=, idx:int=, bool enable=, enable:bool=, ):void
Sets whether the tooltip hint is enabled for specified item index.

void sort_items_by_text<>():void
Sorts items in the list by their text.




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...