---
title: "addDropListItem"
canonical: "https://help.vicon.com/space/ShogunPost118/544278714/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/ShogunPost118/pages/544279211) 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

|  |
| --- |
| `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/ShogunPost118/pages/544279211)
- [deleteAllDropListItems](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost118/pages/544279442)
- [deleteDropListItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost118/pages/544279484)
- [findDropListItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost118/pages/544279698)
- [getDropListItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost118/pages/544280068)
- [getDropListSelItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost118/pages/544280075)
- [getNumDropListItems](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost118/pages/544280426)
- [selectDropListItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost118/pages/544281799)
- [setDropListHandler](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost118/pages/544282096)