---
title: "getDropListItem"
canonical: "https://help.vicon.com/space/Shogun112/31228712/getDropListItem"
format: markdown
---
# Description

Gets the string of an item in the drop list user control that is specified by `userControlID`.

If an invalid index is specified, the command fails.

## Functional area

User Window

# Command syntax

## Syntax

|  |
| --- |
| `getDropListItem userControlID itemIndex` |

### Arguments

| **Name** | **Type** | **Required** | **Comments** |
| --- | --- | --- | --- |
| `index` | int | yes | Index of the drop list item to get. |
| `userControlId` | int | yes | ID of user control to operate on. |

### Flags

None

## Return value

string 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Get the string of an item in the Drop List User Control 
int $windowId;
int $controlId;
int $i, $numItems;
string $itemStr;
 
// 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";
addDropListItem $controlId "Item 2";
addDropListItem $controlId "Item 3";
 
// Get the number of items.
$numItems = `getNumDropListItems $controlId`;
 
// Iterate through the list of items.
for( $i = 0; 
  $i < $numItems; 
  $i += 1 )
     { 
        $itemStr = `getDropListItem $controlId $i`; 
        print $itemStr;
}
```

# Additional information

## Related commands

- [addDropListItem](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31228516)
- [createDropList](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31228564)
- [deleteAllDropListItems](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31238960)
- [deleteDropListItem](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31237295)
- [findDropListItem](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31230240)
- [getDropListSelItem](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31237259)
- [getNumDropListItems](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31233298)
- [selectDropListItem](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31238922)
- [setDropListHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31238746)