Implementing Press and Hold

Tutorials for working with our software
Locked
User avatar
DemoPad
Site Admin
Posts: 770
Joined: Thu Jun 14, 2012 10:46 am
Contact:

Implementing Press and Hold

Post by DemoPad » Thu Jul 05, 2012 3:58 pm

Press and Hold is useful for mimicking real remotes where you would hold down a button to do an action. For example, turning up the volume of a TV by holding down a button rather than clicking the same button many times.

** NOTE in the latest version of the software, you can use the press/hold action type in the gesture actions to repeatedly send commands while the button is being held. The information below is now outdated, but still serves to explain how to use flags / page load actions ***

To do this first create a button and a flag. Have the button set the flag to ON when the user presses down the button and OFF when the user releases their finger. Now, go to the page load actions and enter a command to do an action only when the flag is ON and to repeat this command every x seconds (typically around 0.5 seconds works well).

In practice, this would mean that when a user presses down a button it sets a flag to on which then sends a command every 0.5 seconds while the user has their finger down. When the user releases their finger the flag is set to OFF meaning no more commands will be sent.

Please see the attached sample project

Tags
press and hold button
You do not have the required permissions to view the files attached to this post.

Locked