Selects an item in the drop list user control that is specified by userControlID
.
The selected item is the item that is displayed when the drop list is collapsed. When it is dropped, the selected item is highlighted. If no item is selected, no text is displayed when the drop list is collapsed, and no items are highlighted when dropped.
To remove selection, pass a -1 as the index argument.
User Window
selectDropListItem userControlID indexOrString |
Name | Type | Required | Comments |
---|---|---|---|
index | int | yes | Zero based index of the item to select. |
userControlId | int | yes | ID of user control to operate on. |
None
boolean
// Select an item in a Drop List User Control.
int $windowId;
int $controlId;
int $index;
// 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";
$index = `addDropListItem $controlId "Item 2"`;
addDropListItem $controlId "Item 3";
// Select the item whose index we just got.
selectDropListItem $controlId $index;