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

---

# Description

This button behaves like a simple push button and enables users to distinguish between short and long presses. It has only two states - State Up and State Pushed. The button is in State Pushed when it is pushed, otherwise, it is in State Up. The button generates an OnPress event when it is pressed.

# 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 |
| ShortPressTime | Time | Any non-negative | 0:0.4 | Time boundary between short and long press. |

# 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.

## IsButtonPressed

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

#### Syntax

```visualbasic
Function IsButtonPressed() As Boolean
```

## SetShortPressTime 

This function sets ShortPressTime of the button. The function returns True on success or False if an error occurs (i.e. newshortpresstime < :.0).

#### Syntax

```visualbasic
Function SetShortPressTime(newshortpresstime As Time) As Boolean
```

## GetShortPressTime 

This function returns the current ShortPressTime of the button.

#### Syntax

```visualbasic
Function GetShortPressTime() As Time
```

## 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

## OnPress 

This event is generated when the button is released (in case that press is shorter then ShortPressTime) or after ShortPressTime from the start of pushing the button (in case of long press). If press of the button is shorter then ShortPressTime, shortpress parameter is True, otherwise shortpress is False.

#### Syntax

```visualbasic
Event OnPress As Process(shortpress As Boolean)
```