---
title: "DILongPressButton, DIOLongPressButton, GIOLongPressButton, UniversalLongPressButton, VersatileLongPressButton"
canonical: "https://docs.cuesystem.com/space/CVCDD/439844921/DILongPressButton%2C%20DIOLongPressButton%2C%20GIOLongPressButton%2C%20UniversalLongPressButton%2C%20VersatileLongPressButton"
format: markdown
---
> Macro (toc)

---

# Description

These drivers convert digital input, digital I/O input, general I/O input, or versatile input to a long press button. Appropriate driver emulates the touch panel button with the same functionality. The potential free button has to be connected between the appropriate channel pin and the ground.

# Properties

|  |  |  |  |  |
| --- | --- | --- | --- | --- |
| Property Name | Data Type | Allowed Values | Default Value | Description |
| Behavior |
| LongPressTime | Time | Any positive | :0.4 | Time boundary between short and long press |

# Functions

## IsPressed

This function returns True, if the input pin is closed to the ground (button is pressed). It returns False if the input pin is opened (button is released).

#### Syntax

```visualbasic
Function IsPressed () As Boolean
```

## WaitWhilePressed

This function waits while the input pin is closed (button is pressed). Parameter timeout specifies maximum time for the waiting. If the input is opened (button is released) before timeout, the function returns True. If the time interval exceeds the specified timeout, the function returns False even if the input pin is still in the closed state (button is pressed).

#### Syntax

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

## SetLongPressTime

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

#### Syntax

```visualbasic
Function SetLongPressTime (newlongpresstime As Time) As Boolean
```

## GetLongPressTime

This function returns the current LongPressTime of the button.

#### Syntax

```visualbasic
Function GetLongPressTime () As Time
```

# Events

## OnPress As Process

This event is generated when the input pin switches between the close state (button is released) and the open state (button is pressed) in case that press is shorter then LongPressTime or after LongPressTime from the start of pushing the button (in case of long press). If press of the button is shorter then LongPressTime, longpress parameter is False, otherwise longpress is True.

#### Syntax

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

> 📝 Note: The parameter of OnPress Event was named shortpress and passed value was negated in LongPressButton drivers version 1. Due to the unification of the API with Generic Objects graphic collection we change name and value of this parameter in LongPressButton drivers version 2 to longpress.