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>")
 
(80 intermediate revisions by 16 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| ofp |= Game name
|game1= ofp
|version1= 1.75


|1.5|= Game version
|game2= ofpe
|version2= 1.00


|arg= local |= Arguments in MP
|game3= arma1
|version3= 1.00


|eff= local |= Effects in MP
|game4= arma2
____________________________________________________________________________________________
|version4= 1.00


| Adds an item with the given text to the listbox or combobox with id idc of the topmost user dialog.
|game5= arma2oa
|version5= 1.50


It returns the index of the newly added item. |= Description
|game6= tkoh
____________________________________________________________________________________________
|version6= 1.00


| '''lbAdd ''[idc, text]''''' |= Syntax
|game7= arma3
|version7= 0.50


|p1= [idc, text]: [[Array]] |= Parameter 1
|arg= local


| [[Number]] |= Return value
|eff= local
____________________________________________________________________________________________
 
|x1= <pre>_index = lbAdd [101, "First item"]</pre> |= Example 1
____________________________________________________________________________________________


| |= See also
|gr1= GUI Control - ListBox


|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]
|p1= idc: [[Number]] - control IDC
|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]]
}}
}}


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
<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>
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|LBADD]]
[[Category:Scripting Commands OFP 1.96|LBADD]]
[[Category:Scripting Commands ArmA|LBADD]]

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.