lbAdd: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(86 intermediate revisions by 17 users not shown)
Line 1: Line 1:
[[Category:Scripting Commands|LBADD]]
{{RV|type=command
[[Category:Scripting Commands OFP 1.97|LBADD]]
[[Category:Scripting Commands ArmA|LBADD]]


|game1= ofp
|version1= 1.75


<h2 style="color:#000066"> '''lbAdd [''idc'', ''text'']'''</h2>
|game2= ofpe
|version2= 1.00


|game3= arma1
|version3= 1.00


'''Operand types:'''
|game4= arma2
|version4= 1.00


'''[idc, text]:''' [[Array]]
|game5= arma2oa
|version5= 1.50


'''Type of returned value:'''
|game6= tkoh
|version6= 1.00


[[Number]]
|game7= arma3
|version7= 0.50


'''Compatibility:'''
|arg= local


Added in version '''1.50'''
|eff= local


'''Description:'''
|gr1= GUI Control - ListBox


Add item with given '''text''' to listbox or combobox with id '''idc''' of topmost user [[dialog]].
|descr= Adds an item with the given text to the [[CT_LISTBOX]] or [[CT_COMBO]] or [[CT_TOOLBOX]].


Return index of new added item.
{{Feature|informative| If using {{hl|RscToolBox}} as template with [[ctrlCreate]], clear it first with [[lbClear]]}}


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


'''Example:'''
|p1= idc: [[Number]] - control IDC


_index = '''lbAdd''' [101, "First item"]
|p2= text: [[String]] - visible text
 
|r1= [[Number]] - index (row) of newly added item
 
|s2= control [[lbAdd]] text
 
|p21= control: [[Control]]
 
|p22= text: [[String]]
 
|r2= [[Number]] - index (row) of newly added item 
 
|x1= <sqf>_index = lbAdd [101, "First item"];</sqf>
 
|x2= <sqf>_index = _control lbAdd "First item";</sqf>
 
|seealso= [[lbDelete]] [[lbText]]
}}
 
<dl class="command_description">
 
<dt></dt>
<dd class="notedate">Posted: Sep 10 2014</dd>
<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]].
<dt></dt>
<dd class="notedate">Posted on 2015-04-12 - 11:01 (UTC)</dd>
<dt class="note">[[User:Nelis75733126|Nelis75733126]]</dt>
<dd class="note">
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>
<sqf>
_giveYourControlAname = findDisplay 7 displayCtrl 9;
_addThisToListBox = "Option";
_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>
The code above will add an option named "Option" to the ListBox or ComboBox.
</dd>
 
</dl>

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.