lbAdd: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <!-- (DIS)?CONTINUE Notes -->" to "")
m (formatting)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| ofp
|game1= ofp


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


|arg= local
|arg= local
Line 11: Line 35:
|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]].
<br>
 
It returns the index of the newly added item.
|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]]
|p21= control: [[Control]]
|p22= text: [[String]]
|p22= text: [[String]]


|r2= [[Number]] - row index |RETURNVALUE2=  
|r2= [[Number]] - Index (row) of newly added item 
 
|x1= <code>_index = [[lbAdd]] [101, "First item"];</code>
|x1= <code>_index = [[lbAdd]] [101, "First item"];</code>


|x2= <code>_index = _control [[lbAdd]] "First item";</code>
|x2= <code>_index = _control [[lbAdd]] "First item";</code>


|seealso= [[lbClear]], [[lbColor]], [[lbCurSel]], [[lbData]], [[lbDelete]], [[lbIsSelected]], [[lbPicture]], [[lbSelection]], [[lbSetColor]], [[lbSetCurSel]], [[lbSetData]], [[lbSetPicture]], [[lbSetSelected]], [[lbSetTooltip]], [[lbSetValue]], [[lbSize]], [[lbSort]], [[lbSortByValue]], [[lbText]], [[lbValue]]
|seealso= [[lbDelete]] [[lbText]]
}}
}}


Line 41: Line 65:
<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>
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}


<dl class="command_description">
<dl class="command_description">
Line 55: Line 73:
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;
<code>_giveYourControlAname = [[findDisplay]] 7 [[displayCtrl]] 9;
_addThisToListBox = "Option";
_addThisToListBox = "Option";
_giveYourControlAname lbAdd _addThisToListBox;</code>
_giveYourControlAname [[lbAdd]] _addThisToListBox;</code>
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>

Revision as of 18:02, 12 April 2021

Hover & click on the images for description

Description

Description:
Adds an item with the given text to the CT_LISTBOX or CT_COMBO.
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 April 12, 2015 - 11:01 (UTC)
IT07
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.