Does TouchGFX's clickevent support "long press" event?
..
..
Oh, I misunderstood - I thought it was for a Click Event for a Button and not a view. The code should be the same - Except you don't have to register as a timer widget to receive ticks and keep track of time. You're already receiving ticks in your view through the handleTickEvent() method.
So, instead of just looking at evt.getType(), start a timer when you receive the first clickEvent (manage some state through the handleTickEvent() method. Once your time-threshold has been reached and the user has NOT released yet, then do whatever you want to do for your "long press". Does that make sense?
Some quick pesudo code to explain:
void Screen1View::handleClickEvent(ClickEvent& evt)
{
if(evt.pressed)
{
evaluate_long_press = true;
}
else if(evt.released)
{
evaluate_long_press = false;
counter = 0;
}
}
void Screen1View::handleTickEvent()
{
if(evaluate_long_press)
{
counter++;
if(counter == 1000)
{
execute_long_press_action();
evaluate_long_press = false;
}
}
}Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.