---
title: "getDropListSelItem"
canonical: "https://help.vicon.com/space/ShogunPost121/1253736825/getDropListSelItem"
format: markdown
---
# Description

Gets the zero-based index of the selected item in the drop list user control that is specified by `userControlID`.

If no item is selected, -1 is returned.

## Functional area

User Window

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `getDropListSelItem userControlID` |

### Arguments

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `userControlId` | int | yes | ID of user control to operate on. |

### Flags

None

## Return value

integer 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Get the selected Drop List User Control item
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 "Item 1";
addDropListItem $controlId "Item 2";
addDropListItem $controlId "Item 3";
 
// Select the second item
selectDropListItem $controlId 1;
 
// Get the selected item
$index = `getDropListSelItem $controlId`;
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)
- [findDropListItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736586)
- [getDropListItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737152)
- [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)