Skip to main content

Double click button

You may wish to detect 'double-click' or 'triple-click' on buttons. This would be useful for showing special menus (layers) - or sending commands that need a little more security.

To detect 'multiple-clicks' we use 'Event handler - preprocessor'.

In this simple guide we use a variable called "ShowMenu" with two options: off / on.
Then we create a behavior on a button - that it must be double-clicked in order to set "ShowMenu" to 'on'

• right-click button and select 'Create behavior'
  - Parameter:                Var:ShowMenu
  - Settings template:   [leave blank]

• click 'Show more' > at Event handler enter name "DblPress" and click 'Create' > open the new Event handler
  - Handler type:           Binary
  - Set values:               'on'

behavior.png

• In the Event Preprocessor section > From binary > click '+' to create > click it to edit
• select 'Default' > click '+' to create > click 'ActDown' to select it
  - Repeat:                    Delayed      <-- this start the timer
  - Repeat delay:          300             <-- timer lenght in milleseconds
  - Burst count:            2                  <-- number of required pressed to give output
  - Output trigger:       ActDown

preprocessor.png

With the above, you must press button 2 times within 300ms for the action to proceed (ie. set ShowMenu to 'on')