lbAdd: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{Command " to "{{RV|type=command ")
m (Text replacement - "IT07" to "Nelis.75733126")
 
(30 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| ofp
|game1= ofp
|version1= 1.75


|1.5
|game2= ofpe
|version2= 1.00
 
|game3= arma1
|version3= 1.00
 
|game4= arma2
|version4= 1.00
 
|game5= arma2oa
|version5= 1.50
 
|game6= tkoh
|version6= 1.00
 
|game7= arma3
|version7= 0.50


|arg= local
|arg= local
Line 11: Line 28:
|gr1= GUI Control - ListBox
|gr1= GUI Control - ListBox


| Adds an item with the given text to the listbox or combobox with id idc of the topmost user [[dialog]].
|descr= Adds an item with the given text to the [[CT_LISTBOX]] or [[CT_COMBO]] or [[CT_TOOLBOX]].
<br>
 
It returns the index of the newly added item.
{{Feature|informative| If using {{hl|RscToolBox}} as template with [[ctrlCreate]], clear it first with [[lbClear]]}}
 
|s1= [[lbAdd]] [idc, text]


| [[lbAdd]] [idc, text]
|p1= idc: [[Number]] - control IDC


|p1= [idc, text]: [[Array]]
|p2= text: [[String]] - visible text
|p2= idc: [[Number]] of control
|p3= text: [[String]]


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


|s2= control [[lbAdd]] text
|s2= control [[lbAdd]] text


|p21= control: [[Control]] |PARAMETER21=
|p21= control: [[Control]]
|p22= text: [[String]] |PARAMETER22=


|r2= [[Number]] - row index |RETURNVALUE2=  
|p22= text: [[String]]
|x1= <code>_index = [[lbAdd]] [101, "First item"];</code>


|x2= <code>_index = _control [[lbAdd]] "First item";</code>
|r2= [[Number]] - index (row) of newly added item


| [[lbClear]], [[lbColor]], [[lbCurSel]], [[lbData]], [[lbDelete]], [[lbIsSelected]], [[lbPicture]], [[lbSelection]], [[lbSetColor]], [[lbSetCurSel]], [[lbSetData]], [[lbSetPicture]], [[lbSetSelected]], [[lbSetTooltip]], [[lbSetValue]], [[lbSize]], [[lbSort]], [[lbSortByValue]], [[lbText]], [[lbValue]]
|x1= <sqf>_index = lbAdd [101, "First item"];</sqf>
 
|x2= <sqf>_index = _control lbAdd "First item";</sqf>
 
|seealso= [[lbDelete]] [[lbText]]
}}
}}


<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:Nelis.75733126|Nelis.75733126]]</dt>
[[Category:Scripting Commands|LBADD]]
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.96|LBADD]]
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}
 
<!-- 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 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.