lbAdd: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^ ]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^ ]*)<\/code>" to "<code>$1$2$3</code>")
m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(12 intermediate revisions by the same user not shown)
Line 30: Line 30:
|descr= Adds an item with the given text to the [[CT_LISTBOX]] or [[CT_COMBO]] or [[CT_TOOLBOX]].
|descr= Adds an item with the given text to the [[CT_LISTBOX]] or [[CT_COMBO]] or [[CT_TOOLBOX]].


{{Feature|Informative| If using {{hl|RscToolBox}} as template with [[ctrlCreate]], clear it first with [[lbClear]]}}
{{Feature|informative| If using {{hl|RscToolBox}} as template with [[ctrlCreate]], clear it first with [[lbClear]]}}


|s1= [[lbAdd]] [idc, text]
|s1= [[lbAdd]] [idc, text]


|p1= idc: [[Number]] - Control IDC
|p1= idc: [[Number]] - control IDC


|p2= text: [[String]] - Visible text
|p2= text: [[String]] - visible text


|r1= [[Number]] - Index (row) of newly added item
|r1= [[Number]] - index (row) of newly added item


|s2= control [[lbAdd]] text
|s2= control [[lbAdd]] text
Line 46: Line 46:
|p22= text: [[String]]
|p22= text: [[String]]


|r2= [[Number]] - Index (row) of newly added item   
|r2= [[Number]] - index (row) of newly added item   


|x1= <code>_index = lbAdd [101, "First item"];</code>
|x1= <sqf>_index = lbAdd [101, "First item"];</sqf>


|x2= <code>_index = _control lbAdd "First item";</code>
|x2= <sqf>_index = _control lbAdd "First item";</sqf>


|seealso= [[lbDelete]] [[lbText]]
|seealso= [[lbDelete]] [[lbText]]
Line 62: Line 62:
<dd class="note">More information on the [[CT_LISTBOX]] command family can be found [[CT_LISTBOX#Scripting_Example|here]].
<dd class="note">More information on the [[CT_LISTBOX]] command family can be found [[CT_LISTBOX#Scripting_Example|here]].
<dt></dt>
<dt></dt>
<dd class="notedate">Posted on April 12, 2015 - 11:01 (UTC)</dd>
<dd class="notedate">Posted on 2015-04-12 - 11:01 (UTC)</dd>
<dt class="note">[[User:IT07|IT07]]</dt>
<dt class="note">[[User:Nelis75733126|Nelis75733126]]</dt>
<dd class="note">
<dd class="note">
This command can be very very frustrating to use because it does not output any errors if unable to function.<br>
This command can be very very frustrating to use because it does not output any errors if unable to function.<br>
Often, the 2nd provided syntax needs to be used like this:<br>
Often, the 2nd provided syntax needs to be used like this:<br>
<code>_giveYourControlAname = [[findDisplay]] 7 [[displayCtrl]] 9;
<sqf>
_giveYourControlAname = findDisplay 7 displayCtrl 9;
_addThisToListBox = "Option";
_addThisToListBox = "Option";
_giveYourControlAname [[lbAdd]] _addThisToListBox;</code>
_giveYourControlAname lbAdd _addThisToListBox;
</sqf>
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.<br>
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.<br>
The code above will add an option named "Option" to the ListBox or ComboBox.
The code above will add an option named "Option" to the ListBox or ComboBox.

Latest revision as of 11:34, 3 September 2024

Hover & click on the images for description

Description

Description:
Adds an item with the given text to the CT_LISTBOX or CT_COMBO or CT_TOOLBOX.
If using RscToolBox as template with ctrlCreate, clear it first with lbClear
Groups:
GUI Control - ListBox

Syntax

Syntax:
lbAdd [idc, text]
Parameters:
idc: Number - control IDC
text: String - visible text
Return Value:
Number - index (row) of newly added item

Alternative Syntax

Syntax:
control lbAdd text
Parameters:
control: Control
text: String
Return Value:
Number - index (row) of newly added item

Examples

Example 1:
_index = lbAdd [101, "First item"];
Example 2:
_index = _control lbAdd "First item";

Additional Information

See also:
lbDelete lbText

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Posted: Sep 10 2014
ffur2007slx2_5
More information on the CT_LISTBOX command family can be found here.
Posted on 2015-04-12 - 11:01 (UTC)
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.