All Forums > Programming Questions

Checking if button was held in click handler


I am trying to make a simple menu system using the MenuBackend library and the Button library being driven by 3 buttons. 2 buttons will drive the up and down behavior of the menu and the 3rd button will be left and right. I want right to happen when the button is clicked and left to happen when the button is held for one second. The problem I am having is that the click handler is being called after the hold Handler and there is now way to check in the click handler to check if the held handler was called. I tried calling "held(1000)" and heldFor(1000) in my click handler but it always returns false. I think this is because "triggeredHoldEvent" is true in "held()" and "isPressed()" is false in "heldFor()". The only think I could think of is check "btn.holdTime()<1000" in my click handler.

Any help would be appreciated.

well its just a list of commands, no logic or anything so theres not really anything anyone could suggest


[0] Message Index

Go to full version