/
createDropList
createDropList
Description
Creates a drop list user control on the user window specified by windowID
.
A drop list enables the user to select from a set of list of items, with the list dynamically displaying when the user clicks an arrow button.
The control is initially placed in the top-left corner of the user window, and must be placed by using the -pos
option, or by using the setControlPos command.
The height of the "edit" portion of the drop list is always fixed, regardless of the height specified using the -pos option or setControlPos command. The height of the list portion of the drop list is specified by the height of the control.
The command returns the Control ID of the user control, which should be saved for later operations on the control.
Functional area
User Window
Command syntax
Syntax
createDropList parentWindowID "itemStr1" "itemStr2"...[-hidden] [-pos integer array] [-form integer] [-sort] [-sel integer] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
item1 | string | no | One or more strings are allowed to populate the list portion of the drop list. |
windowId | int | yes | ID of user window to place the control on. |
Flags
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
sort | 0 | — | — | Forces the control to automatically sort the items in the list. The default is unsorted. |
hidden | 0 | — | — | Specifies that the control should be hidden initially. Call showControl to subsequently make it visible. The default is for it to be visible. |
sel | 1 | integer | — | A zero based index of the item to be selected. The default is no selection. |
pos | 1 | integer array | — | A four-element int array representing a rectangle, which specifies the initial size/position of the control relative to the top left corner of the user window. The element order is Left, Top, Right, and Bottom. The default is a drop list 100 units high by 100 units wide. |
form | 1 | integer | — | Control ID of the form user control which will dynamically position this control. |
Return value
integer
Examples
// Create a drop list user control. int $windowId; int $controlId; // First create a user window to place the Control on $windowId = `createWindow "MyWindow"`; // Create the Control on the Window, passing // in the Window Id of the user window we // just created. Make the list sorted, add some items, // and set the initial selection $controlId = `createDropList $windowId "Item #3" "Item #1" "Item #2" -sort -sel 2`;
Additional information
Related commands
, multiple selections available,