top of page
Button

Button

Category:

AddIn:

Scope:

Code Snippets:

Supports Material List:

Status Screen Widgets:

License:

Input Registration

Base Elements

Local

Triggered

no

no

Standard EventIDE license

In this article:


Introduction

The Button element monitors participant responses from standard input devices supported by Windows, including keyboards, computer mouses, gamepads, and joysticks. It provides accurate event timing information and is commonly used for response collection, reaction time measurement, behavioral task control, and participant interaction during experiments.


The element can detect presses, releases, or sustained button states, making it suitable for a wide range of experimental paradigms.


Description

The Button element continuously monitors a selected button on a chosen input device and records its activity relative to the onset of the parent event. The element automatically stores the exact triggering time, identifies which button was pressed, and exposes runtime properties that can be used in Flow Routes, Conditions, and Code Snippets.


Multiple Button elements can be used simultaneously to monitor different response keys or different input devices.


Typical applications include:

  • Reaction-time experiments

  • Go/No-Go paradigms

  • Two-alternative forced-choice (2AFC) tasks

  • Cognitive and behavioral testing

  • Motor response measurements

  • Gamepad-based experiments

  • Custom response box integration through keyboard emulation


Key Features

  • Supports keyboards, computer mouses, gamepads, and joysticks

  • Records precise button trigger times

  • Measures reaction times relative to event onset

  • Monitors specific buttons or any button on a device

  • Supports press, release, and continuous-state monitoring

  • Can trigger Flow Routes and event transitions

  • Exposes runtime status for Code Snippets and Conditions

  • Supports multiple simultaneous response devices


Properties

Name

Description

Type

Settings




Device Type

Defines a type of the input button device

Design

Int32

Selected Device

Defines the selected input button device. If the system device is selected, button actions are recorded from all listed devices

Design

Int32

Triggering Mode

Defines the triggering mode for the button. The First Press Only mode is recommended for response time measurements

Design

enButt..

Monitored Button

Defines the button monitored by the element. If Any Button is selected, the element monitors all buttons on the selected device. The actual pressed button can then be identified using the Triggered Button property

Design

Int32

Runtime Status




Triggering Time

Returns the local event time (ms) of the last button trigger. This value can be used as an accurate response time measure

Status

clTime

Is Triggered

Indicates whether a button has been triggered at least once since the onset of the parent event. Commonly used to control flow routes and event transitions

General

Boolean

Triggered Button

Returns the system name of the triggered button. Keyboard keys are reported as capital letters, while mouse and gamepad buttons are reported using names such as "Button 1"

Status

String

Is Down

Indicates whether the monitored button is currently in the down state

General

Boolean

Control




Is Enabled

If set to false the element is completely omitted when the experiment is run

Design

Boolean

Title

Title of the element

Design

String

Practical Use

Technique 1: Recording Participant Responses and Reaction Times


  1. Add a Button element to the stimulus event.

  2. Select the desired input device in Selected Device property in the Properties Panel.

  3. Choose the response key using Monitored Button.

  4. Set Triggering Mode to First Press Only for reaction-time measurements.

  5. Present the stimulus.

  6. Create a Flow Route that advances when Is Triggered = True.

  7. Read Triggering Time to obtain the participant's reaction time.


Example

A participant views a visual stimulus and presses the spacebar as soon as it appears. The Button element records the response time and signals the experiment to continue to the next event.


Technique 2: Two-Alternative Forced Choice (2AFC) Task


  1. Add two Button elements to the response event.

  2. Configure one element to monitor the left response key (e.g., A).

  3. Configure the second element to monitor the right response key (e.g., L).

  4. Use Flow Routes or Code Snippets to determine which button was pressed.

  5. Store response accuracy and reaction time in user variables.


Example

Participants classify faces as male or female using two keyboard buttons. The selected button determines the recorded response category.


Technique 3: Monitoring Any Button Press


When the exact response button is unknown in advance, the Button element can monitor all buttons on a device.

  1. Add a Button element.

  2. Select the desired device in the Properties Panel.

  3. Set Monitored Button property to Any Button.

  4. When a response occurs, read Triggered Button property via a proxy variable to determine which button was pressed.


Example

A gamepad-based task allows participants to use any available button. The Button element records both the response time and the specific button identity.


Technique 4: Continuous Button-State Monitoring


The Button element can be used to detect whether a button is currently held down.

  1. Configure the monitored button.

  2. Read the Is Down property during runtime via a proxy variable.

  3. Use Route Conditions or Code Snippets to react to sustained button presses.


Example

In a force-maintenance task, participants must hold a button continuously during stimulus presentation. The experiment terminates the trial if the button is released.


Notes

  • First Press Only triggering mode is generally recommended for reaction-time measurements because it prevents repeated triggers while a key is held down.

  • The Triggering Time property provides the most accurate response-time measure and should be preferred over manually calculated timestamps.

  • When monitoring Any Button, use the Triggered Button property to identify the participant's response.

  • Multiple Button elements can be combined to create multi-choice response interfaces.

  • Button elements are frequently used together with Condition, Flow Route, and Code Snippet elements for experiment control.

  • If a dedicated response device emulates keyboard input, it can usually be used directly with the Button element without additional configuration.

bottom of page