---
title: "getDropListItem"
canonical: "https://help.vicon.com/space/ShogunPost121/1253737152/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

> Macro (scroll-tablelayout)

|  |
| --- |
| `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;
}
```

> Macro (16dcb1b2-c6fb-4c23-a096-38455b87e6a8/1fa5e51a-a28e-46e1-9b5c-734b339f025f/static/scroll-pagebreak)

# 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)
- [findDropListItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736586)
- [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)