510-770-1417 | info@reachtech.com

by Reach Technology, a Novanta Company
Support > Frequently Asked Questions > How can I create a button that will respond differently to being pressed normally and held down for a long time?

How can I create a button that will respond differently to being pressed normally and held down for a long time?

Here are some simple macros you can install and test; they use bitmaps 1 and 2 from the standard Reach demo.

#define init_test 
s 0 1 
z 
f 13B 
// std round button from demo 
bdc 29 200 100 1 "Test" 1 2 
xmq 29 button_down release_after_short_press 
#end

#define button_down 
w 1000 
xmq 29 button_down release_after_long_press 
#end

#define release_after_short_press 
out "down < 1 sec (short press)\r" 
// reset release macro so we can test again: 
xmq 29 button_down release_after_short_press 
#end

#define release_after_long_press 
out "down > 1 sec (longer press)\r" 
// reset release macro so we can test again: 
xmq 29 button_down release_after_short_press 
#end