---
title: "getListBoxSelItems"
canonical: "https://help.vicon.com/space/Shogun17/13536599/getListBoxSelItems"
format: markdown
---
# Description

Gets the user list box selected items.

Returns an array of zero based indices of the selected items of the list box user control that is specified by `userControlID`.

Because list box user controls can have multiple selected items (if the -multi flag was specified for the [createListBox](https://vicon-help.atlassian.net/wiki/spaces/Shogun17/pages/13537623) command), an array must be returned.

If there are no selected items, an empty array is returned.

## Functional area

User Window

# Command syntax

## Syntax

|  |
| --- |
| `getListBoxSelItems userControlID` |

### Arguments

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

### Flags

None

## Return value

integer array 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Get the selected List Box User Control items
int $windowId;
int $controlId;
int $indices[];
 
// First create a User Window to place the Control on
$windowId = `createWindow "MyWindow"`;
 
// Create the User Control on the Window. 
$controlId = `createListBox $windowId -multi`;
 
// Add some items to the List Box.
addListBoxItem $controlId "Item 1";
addListBoxItem $controlId "Item 2";
addListBoxItem $controlId "Item 3";
 
// Select the second and third items
selectListBoxItem $controlId 1;
selectListBoxItem $controlId 2;
 
// Get the selected items
$indices = `getListBoxSelItems $controlId`;
print $indices;
```

# Additional information

## Related commands

- [addListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/Shogun17/pages/13537673)
- [createListBox](https://vicon-help.atlassian.net/wiki/spaces/Shogun17/pages/13537623)
- [deleteAllListBoxItems](https://vicon-help.atlassian.net/wiki/spaces/Shogun17/pages/13536447)
- [deleteListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/Shogun17/pages/13536409)
- [findListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/Shogun17/pages/13536467)
- [getListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/Shogun17/pages/13536601)
- [getNumListBoxItems](https://vicon-help.atlassian.net/wiki/spaces/Shogun17/pages/13536643)
- [selectListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/Shogun17/pages/13537216)
- [setListBoxHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun17/pages/13537158)