/
addListBoxItem
addListBoxItem
Description
Adds a string that is specified by itemString
to the list box user control that is specified by userControlID
.
Strings are added to the end of the list box, unless the -insert
flag was provided, in which case, the string is inserted at the index specified. If the -sort
flag was provided with the createListBox command, the strings in the list box will appear in alphabetical order, and the -insert
flag has no visible effect.
Functional area
User Window
Command syntax
Syntax
addListBoxItem userControlID "itemString" [-insert integer] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
itemString | string | yes | String to add to the list box. |
userControlId | int | yes | ID of user control to operate on. |
Flags
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
insert | 1 | integer | — | Specifies the zero based index which the string should be inserted. If this flag isn't specified, the item will be appended to the end of the list. |
Return value
integer
Examples
// Add items to a List Box User Control. int $windowId; int $controlId; // First create a User Window to place the Control on $windowId = `createWindow "MyWindow"`; // Create the User Control on the Window. Don't use the // sort flag so we can demonstrate how to insert vs. append. $controlId = `createListBox $windowId`; // Add some items to the List Box. Insert one as well addListBoxItem $controlId "Item 1"; addListBoxItem $controlId "Item 2"; addListBoxItem $controlId "Item 3"; addListBoxItem $controlId "Inserted!" -insert 1; // Set the current selection to the first item selectListBoxItem $controlId 0;
Additional information
Related commands
, multiple selections available,
Related content
getListBoxItem
getListBoxItem
More like this
addDropListItem
addDropListItem
More like this
addDropListItem
addDropListItem
More like this
getListBoxSelItems
getListBoxSelItems
More like this
findListBoxItem
findListBoxItem
More like this
addListViewItem
addListViewItem
More like this