Vicon Shogun banner

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

NameTypeRequiredComments
itemStringstringyesString to add to the list box.
userControlIdintyesID of user control to operate on.

Flags

NameFlag argumentsArgument typeExclusive toComments
insert1integerSpecifies 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