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

Adds a string that is specified by `itemString` to the drop list user control that is specified by `userControlID`.

Strings are added to the end of the drop list, unless the `-insert` flag is provided, in which case, the string is inserted at the index specified. If the `-sort` flag is provided with the [createDropList](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736918) command, the strings in the drop list appear in alphabetical order, and the `-insert` flag has no visible effect.

## Functional area

User Window

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `addDropListItem userControlID "itemString"[-insert integer]` |

### Arguments

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `itemString` | string | yes | String to add to the drop list. |
| `userControlID` | int | yes | ID of user control to operate on. |

### Flags

| Name | Flag arguments | Argument type | Exclusive to | Comments |
| --- | --- | --- | --- | --- |
| `insert` | 1 | integer | — | — |

## Return value

integer

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Add items to a Drop List User Control.
int $windowId;
int $controlId;
// First create a User Window to place the Control on
$windowId = `createWindow "MyWindow"`;
 
// Create the User Control on the Window. Don't use the
// sort flag so we can demonstrate how to insert vs. append.
$controlId = `createDropList $windowId`;
 
// Add some items to the Drop List. Insert one as well
addDropListItem $controlId "Item 1";
addDropListItem $controlId "Item 2"; 
addDropListItem $controlId "Item 3";
addDropListItem $controlId "Inserted!" -insert 1;
 
// Set the current selection to the first item
selectDropListItem $controlId 0;
```

# Additional info

## Related commands

- [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)
- [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)