Arma 3 Scripting

lbAdd

  • Local argument
  • Local effect
  • Arma 3 v0.50
  • First in Operation Flashpoint v1.75

Command · Markdown · JSON · original wiki page

Description

Adds an item with the given text to the CT_LISTBOX or CT_COMBO or CT_TOOLBOX.

Note

If using RscToolBox as template with ctrlCreate, clear it first with lbClear

Syntax

Syntax 1

lbAdd [idc, text]

Parameters:

Returns: Number - index (row) of newly added item

Syntax 2

control lbAdd text

Parameters:

Returns: Number - index (row) of newly added item

Examples

Example 1

_index = lbAdd [101, "First item"];

Example 2

_index = _control lbAdd "First item";

See also

lbDelete · lbText

Community notes

ffur2007slx2_5

More information on the CT_LISTBOX command family can be found here.

Nelis75733126

This command can be very very frustrating to use because it does not output any errors if unable to function.
Often, the 2nd provided syntax needs to be used like this:

_giveYourControlAname = findDisplay 7 displayCtrl 9;
_addThisToListBox = "Option";
_giveYourControlAname lbAdd _addThisToListBox;

Where "7" is the "idd" of the dialog you made in your ".hpp" file and where "9" is the "idc" of the RscListBox or RscComboBox.
The code above will add an option named "Option" to the ListBox or ComboBox.