Skip to content

IdMultiSelect ​

Inherits: VBoxContainer

A list of ids picked from a database type: the picked entries as small tags with an x, and an Add button that opens a searchable list of everything that exists. It takes the place of a row of check boxes, which stop being readable when there are many entries (groups, entity types, abilities, effects).

Description ​

Put the scene (id_multi_select.tscn) in an editor scene, or let StatPropertyFields.add_id_checklist make it. Either way: select.setup("group", ability.groups, "Groups:", func(): mark_resource_modified()) The array is changed in place. With single_select it holds one id: picking another replaces it (an entity has one type).

Properties ​

Stringdatabase_type""
Stringtitle""
boolsingle_selectfalse
Stringempty_text"(none)"

Methods ​

voidsetup( p_database_type: String, ids: Array, p_title: String = "", on_changed: Callable = Callable(), p_single_select: bool = false )
voidset_filter( filter: Callable )
Arrayget_ids()
booltoggle_id( entry_id: int )

Signals ​

changed() ​

Emitted after the ids changed (the array handed to setup is already updated)

Property descriptions ​

String database_type = "" ​

The database type the ids belong to ("group", "entity_tag", "ability" ...)

String title = "" ​

The text over the tags

bool single_select = false ​

One id at most: picking replaces

String empty_text = "(none)" ​

What shows when nothing is picked

Method descriptions ​

void setup( p_database_type: String, ids: Array, p_title: String = "", on_changed: Callable = Callable(), p_single_select: bool = false ) ​

Show ids (changed in place) from the database type. on_changed is called after every change

void set_filter( filter: Callable ) ​

Lists only the entries the filter accepts (a Callable that takes the resource and returns a bool): for example only the entries of one kind. The entries that are picked already are shown whatever the filter says

Array get_ids() ​

The ids that are picked

bool toggle_id( entry_id: int ) ​

Pick or drop one id. Returns whether the list changed