lbAdd: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<dl class="command_description"> <dd class="notedate">" to "<dl class="command_description"> <dt></dt> <dd class="notedate">")
m (Text replacement - "IT07" to "Nelis.75733126")
 
(16 intermediate revisions by 2 users not shown)
Line 28: Line 28:
|gr1= GUI Control - ListBox
|gr1= GUI Control - ListBox


|descr= Adds an item with the given text to the [[CT_LISTBOX]] or [[CT_COMBO]].
|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]]}}


|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 44: 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 54: Line 56:


<dl class="command_description">
<dl class="command_description">
<dt></dt>
<dt></dt>
<dd class="notedate">Posted: Sep 10 2014</dd>
<dd class="notedate">Posted: Sep 10 2014</dd>
<dt class="note">[[User:ffur2007slx2_5|ffur2007slx2_5]]</dt>
<dt class="note">[[User:ffur2007slx2_5|ffur2007slx2_5]]</dt>
<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]].
</dl>
<dl class="command_description">
<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:Nelis.75733126|Nelis.75733126]]</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.
</dd>
</dd>
</dl>
</dl>

Latest revision as of 19:00, 16 April 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)
Nelis.75733126
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.