---
title: "setColorPickerHandler"
canonical: "https://help.vicon.com/space/Shogun16/13340131/setColorPickerHandler"
format: markdown
---
# Description

Sets the event handler for the color picker user control that is specified by `userControlId`.

Event handlers are simply scripts to be called when certain events happen. User controls get notified about changes in state when users interact with them. Each event handler flag takes as an argument a script (which must reside in your script directories).

To clear an event handler, pass the empty string, "", to the flag.

If no options are specified, all handlers are reset, and the user control will not respond to any events.

## Functional area

User Window

# Command syntax

## Syntax

|  |
| --- |
| `setColorPickerHandler userControlId [-change string]` |

### Arguments

> Macro (scroll-tablelayout)

| **Name** | **Type** | **Required** | **Comments** |
| --- | --- | --- | --- |
| `userControlId` | int | yes | ID of user control to set event handler for. Specifies the script to call when the user changes the color of the color picker. |

### Flags

| **Name** | **Flag arguments** | **Argument type** | **Exclusive to** | **Comments** |
| --- | --- | --- | --- | --- |
| `change` | 1 | string | — | — |

## Return value

void 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Set the event handler for the User Color Picker.
int $windowId;
int $controlId;
 
// First create a User Window to place the Control on
$windowId = `createWindow "MyWindow"`;
 
// Create the User Control on the Window.
$controlId = `createColorPicker $windowId`;
 
// Save the control ID to our profile, so we can retrieve it
// from the event handler
writeProfileInt "MyWindowSection" "ColorPickerId" $controlId;
 
// Set the -change event handler for the Color Picker. When
// the user changes the color of the Color Picker, this script will be
// executed. ColorPickerChangeHandler must reside in one of
// the scripts directories.
setColorPickerHandler $controlId -change "ColorPickerChangeHandler";
```

# Additional information

## Related commands

- [setCheckBoxHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13340254)
- [setDropListHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13340158)
- [setListBoxHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13340008)
- [setNumBoxHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13340197)
- [setPushButtonHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13340095)
- [setRadioButtonHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13340233)
- [setStaticBoxHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13341824)
- [setTextBoxHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13341815)
- [setTimeBoxHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13341836)
- [setWindowHandler](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13341703)