lbAdd: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Arma[ _]3(\|.*)\]\]" to "{{GameCategory|arma3|Scripting Commands}}")
m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(41 intermediate revisions by 3 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 |Multiplayer Arguments=
|game3= arma1
|version3= 1.00


|eff= local |Multiplayer Effects=
|game4= arma2
|version4= 1.00


|gr1= GUI Control - ListBox |GROUP1=
|game5= arma2oa
____________________________________________________________________________________________
|version5= 1.50


| Adds an item with the given text to the listbox or combobox with id idc of the topmost user [[dialog]].
|game6= tkoh
<br>
|version6= 1.00
It returns the index of the newly added item. |DESCRIPTION=
____________________________________________________________________________________________


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


|p1= [idc, text]: [[Array]] |PARAMETER1=
|arg= local
|p2= idc: [[Number]] of control |PARAMETER2=
|p3= text: [[String]] |PARAMETER3=


| [[Number]] - row index |RETURNVALUE=
|eff= local


|gr1= GUI Control - ListBox


|s2= control [[lbAdd]] text |SYNTAX2=
|descr= Adds an item with the given text to the [[CT_LISTBOX]] or [[CT_COMBO]] or [[CT_TOOLBOX]].


|p21= control: [[Control]] |PARAMETER21=
{{Feature|informative| If using {{hl|RscToolBox}} as template with [[ctrlCreate]], clear it first with [[lbClear]]}}
|p22= text: [[String]] |PARAMETER22=


|r2= [[Number]] - row index |RETURNVALUE2=____________________________________________________________________________________________
|s1= [[lbAdd]] [idc, text]
 
|x1= <code>_index = [[lbAdd]] [101, "First item"];</code> |EXAMPLE1=


|x2= <code>_index = _control [[lbAdd]] "First item";</code> |EXAMPLE2=
|p1= idc: [[Number]] - control IDC
____________________________________________________________________________________________


| [[lbClear]], [[lbColor]], [[lbCurSel]], [[lbData]], [[lbDelete]], [[lbIsSelected]], [[lbPicture]], [[lbSelection]], [[lbSetColor]], [[lbSetCurSel]], [[lbSetData]], [[lbSetPicture]], [[lbSetSelected]], [[lbSetTooltip]], [[lbSetValue]], [[lbSize]], [[lbSort]], [[lbSortByValue]], [[lbText]], [[lbValue]] |SEEALSO=
|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 -->
 
<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 LB command family can be found [[List Box|here]]
<dd class="note">More information on the [[CT_LISTBOX]] command family can be found [[CT_LISTBOX#Scripting_Example|here]].
<!-- Note Section END -->
<dt></dt>
</dl>
<dd class="notedate">Posted on 2015-04-12 - 11:01 (UTC)</dd>
 
<dt class="note">[[User:Nelis75733126|Nelis75733126]]</dt>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|LBADD]]
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.96|LBADD]]
{{GameCategory|arma1|Scripting Commands}}
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma3|Scripting Commands}}
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on April 12, 2015 - 11:01 (UTC)</dd>
<dt class="note">[[User:IT07|IT07]]</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>
<!-- DISCONTINUE Notes -->

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.