---
title: "ToggleButton (Basic)"
canonical: "https://docs.cuesystem.com/space/CVCGC/402128918/ToggleButton%20(Basic)"
format: markdown
---
> Macro (toc)

---

# Description

This button has the following stable states State Up, State Down, and also State Pushed if it is pressed. Each button push toggles between State Up and State Down. The button generates the event OnToggle. You can choose whether the event is generated when the button is pressed or when the button is released.

# Properties

See section [https://cue.atlassian.net/wiki/spaces/CVCGC/pages/399769615/BasicButtons+Collection#Common-Properties](https://cue.atlassian.net/wiki/spaces/CVCGC/pages/399769615/BasicButtons+Collection#Common-Properties) . In addition, this object uses the following properties.

|  |  |  |  |  |
| --- | --- | --- | --- | --- |
| Property Name | Data Type | Allowed Values | Default Value | Description |
| Behavior |
| EventType | Boolean | OnDown = True OnUp = False | OnDown = True | Selects whether OnToggle event is generated when button is pressed (OnDown)<br>or released (OnUp). |
| DefaultState | Long | STATE_UP = 1<br>STATE_DOWN = 2 | STATE_UP = 1 | Default state of the button. |

# Functions

See section [https://cue.atlassian.net/wiki/spaces/CVCGC/pages/399769615/BasicButtons+Collection#Common-Functions](https://cue.atlassian.net/wiki/spaces/CVCGC/pages/399769615/BasicButtons+Collection#Common-Functions) . In addition, this object uses the following functions.

## SetEventTypeOnDown

This function sets the OnToggle event generation to the moment of button press (OnDown). Function returns True.

#### Syntax

```visualbasic
Function SetEventTypeOnDown() As Boolean
```

## SetEventTypeOnUp

This function sets OnToggle event generation to the moment of button release (OnUp). Function returns True.

#### Syntax

```visualbasic
Function SetEventTypeOnUp() As Boolean
```

## IsEventTypeOnDown

This function returns True if the OnToggle event is generated when the button is pressed, or False if the OnToggle event is generated when the button is released.

#### Syntax

```visualbasic
Function IsEventTypeOnDown() As Boolean
```

## SetStateDown

This function sets a button to State Down. Function returns True.

#### Syntax

```visualbasic
Function SetStateDown() As Boolean
```

## SetStateUp

This function sets a button to State Up. Function returns True.

#### Syntax

```visualbasic
Function SetStateUp() As Boolean
```

## IsStateDown 

This function returns True if the button is in State Down or False if the button is in State Up.Syntax

```visualbasic
Function IsStateDown() As Boolean
```

# Events

## OnToggle 

This events is generated when a button is pressed or released (depends on EventType property value). If state is changed to State Down, isdown parameter is True, otherwise isdown is False.

#### Syntax

```visualbasic
Event OnToggle As Process(isdown As Boolean)
```