Description
Gets the string of an item in the drop list user control that is specified by userControlID
.
If an invalid index is specified, the command fails.
Functional area
User Window
Command syntax
Syntax
getDropListItem userControlID itemIndex |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
index | int | yes | Index of the drop list item to get. |
userControlId | int | yes | ID of user control to operate on. |
Flags
None
Return value
string
Examples
// Get the string of an item in the Drop List User Control
int $windowId;
int $controlId;
int $i, $numItems;
string $itemStr;
// First create a User Window to place the Control on
$windowId = `createWindow "MyWindow"`;
// Create the User Control on the Window.
$controlId = `createDropList $windowId`;
// Add some items to the Drop List.
addDropListItem $controlId "Item 1";
addDropListItem $controlId "Item 2";
addDropListItem $controlId "Item 3";
// Get the number of items.
$numItems = `getNumDropListItems $controlId`;
// Iterate through the list of items.
for( $i = 0;
$i < $numItems;
$i += 1 )
{
$itemStr = `getDropListItem $controlId $i`;
print $itemStr;
}