Adds a string that is specified by itemString
to the drop list user control that is specified by userControlID
.
Strings are added to the end of the drop list, unless the -insert
flag is provided, in which case, the string is inserted at the index specified. If the -sort
flag is provided with the createDropList command, the strings in the drop list appear in alphabetical order, and the -insert
flag has no visible effect.
User Window
addDropListItem userControlID "itemString"[-insert integer] |
Name | Type | Required | Comments |
---|---|---|---|
itemString | string | yes | String to add to the drop list. |
userControlID | int | yes | ID of user control to operate on. |
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
insert | 1 | integer | — | — |
integer
// Add items to a Drop List 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 = `createDropList $windowId`;
// Add some items to the Drop List. Insert one as well
addDropListItem $controlId "Item 1";
addDropListItem $controlId "Item 2";
addDropListItem $controlId "Item 3";
addDropListItem $controlId "Inserted!" -insert 1;
// Set the current selection to the first item
selectDropListItem $controlId 0;