---
title: "TwoStatePushButton (Generic)"
canonical: "https://docs.cuesystem.com/space/CVCGC/419987457/TwoStatePushButton%20(Generic)"
format: markdown
---
> Macro (toc)

---

# Description

This button has a similar behavior as PushButton, but it has the additional possibility to set State Down. When a button is not pressed, it has State Up or State Down depending on property DefaultState and previous use of commands SetStateUp or SetStateDown. The button generates OnPush event when it is pushed.

# Properties

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

|  |  |  |  |  |
| --- | --- | --- | --- | --- |
| Property Name | Data Type | Allowed Values | Default Value | Description |
| Behavior |
| DefaultState | Boolean | Down<br>Up | False = Up | Default state of the button |

# Functions

See section [https://cue.atlassian.net/wiki/spaces/CVCGC/pages/417234965/GenericButtons#Common-Functions](https://cue.atlassian.net/wiki/spaces/CVCGC/pages/417234965/GenericButtons#Common-Functions). In addition, this object uses the following properties.

## IsButtonPressed

By this function, you can test whether the button is pushed (function returns True) or not (return value is False).

#### Syntax

```visualbasic
Function IsButtonPressed() 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 when a button is in State Down, or False when a button is in State Up.

#### Syntax

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

## WaitWhilePressed

This function waits for the end of button push. If optional timeout parameter is used, the maximum waiting time is limited by timeout value. In case of timeout excess, function returns False, otherwise it returns True.

#### Syntax

```visualbasic
Function WaitWhilePressed(Optional timeout As Time := _TIME_INFINITE) As Boolean
```

# Events

## OnPush 

This event is generated if the button is pushed.

#### Syntax

```visualbasic
Event OnPush As Process()
```