---
title: "findDropListItem"
canonical: "https://help.vicon.com/space/ShogunPost121/1253736586/findDropListItem"
format: markdown
---
# 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

> Macro (scroll-tablelayout)

|  |
| --- |
| `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. |

> Macro (scroll-pagebreak)

### Flags

> Macro (scroll-tablelayout)

| 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

```plaintext
// 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

- [addDropListItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736554)
- [createDropList](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736918)
- [deleteAllDropListItems](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737405)
- [deleteDropListItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736653)
- [getDropListItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737152)
- [getDropListSelItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736825)
- [getNumDropListItems](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253739071)
- [selectDropListItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737783)
- [setDropListHandler](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253738701)