/
findDropListItem
findDropListItem
Description
Searches for a string in the drop list user control that is specified by userControlID
.
The search is case-insensitive. By default, the search begins at the beginning of the list, searching for itemString
as an exact match or prefix of any of the drop list items.
If the -start
flag is specified, the search will begin after the index provided, wrapping back to the top of the list, up until the provided index if a match isn't made.
If the -exact
flag is specified, the search will only be satisfied if a full string match is made. If itemString
isn't found, then a value of -1 is returned.
Functional area
User Window
Command syntax
Syntax
findDropListItem userControlID "itemString"[-start integer] [-exact] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
itemString | string | yes | String to find in the drop list. |
userControlId | int | yes | ID of user control to operate on. |
Flags
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
start | 1 | integer | — | Index of the item to start searching after. By default, the search will begin at the beginning of the list of items. |
exact | 0 | — | — | Performs the search using an exact, case insensitive, string comparison. By default, the search will be satisfied if the search string is a prefix of an item string. |
Return value
integer
Examples
// Search for a string 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 "This is text"; addDropListItem $controlId "This"; addDropListItem $controlId "is text"; // First search for the word "this". It will return // 0, since "this" is a prefix of the first item. $index = `findDropListItem $controlId "this"`; print $index; // Now search for "this" again, this time specifying // the -exact flag. It will return 1 $index = `findDropListItem $controlId "this" -exact`; print $index;
Additional information
Related commands
, multiple selections available,
Related content
selectDropListItem
selectDropListItem
More like this
addDropListItem
addDropListItem
More like this
addDropListItem
addDropListItem
More like this
setDropListHandler
setDropListHandler
More like this
deleteAllDropListItems
deleteAllDropListItems
More like this
findListBoxItem
findListBoxItem
More like this