Skip to reading
GDScript Programming & Godot

ListBoxAddItem()

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

List Box: Add Item

Add a manual list-box item with an ID, text, optional icon, disabled state and insertion index.

Source table from ListBoxAddItem(), page 180
Option key / fieldMeaning and inputDefault
GUI guiIdChoose an authored GUI ID.Blank
List Box elementIdChoose an element inside the selected GUI.Blank
New Item ID itemIdText.Blank
Item Text textText.Blank
Optional Icon iconAssetIdChoose an imported image. May be blank.Blank
Disabled disabledOn/off.true
Insert Index (-1 = End) insertIndexZero-based insertion position; -1 appends to the list.-1

Timing. Waits for the runtime routine to return; no further completion wait is promised by this schema.

Code example
await ListBoxAddItem({"guiId": "hud", "elementId": "topline", "itemId": "key"})

In use. Add a discovered location to a travel list with a stable ID. An insertion index of -1 appends. Turn Disabled off when the player should be able to select the row. For list boxes bound to an array or inventory, change the data source rather than expecting manual entries to override it permanently.

Page 180 of 378Permalink
Go to page