AnsweredHot!Button issue

Author
bblessing
Super Member
  • Total Posts : 473
  • Reward points : 0
  • Joined: 2008/12/04 06:44:21
  • Location: Cincinnati, OH
  • Status: offline
2017/10/04 11:26:01 (permalink)
0

Button issue

Background: MPLAB X IDE 4.00, XC32 v1.44, Harmony v2.04, PIC32MZ2064DAG176, Newhaven 4.3" display with 4-wire resistive touch panel (ST7282T2 internal controller), internal DDR.
 
If you press a button (showing the pressed state), hold it down, and then release it OUTSIDE of the bounds of the button, then the released event will not be fired. However, the button shows the released state image.
#1
MikeinAZ
Administrator
  • Total Posts : 274
  • Reward points : 0
  • Joined: 2014/06/03 07:25:32
  • Location: Chandler, AZ
  • Status: offline
Re: Button issue 2017/10/04 14:30:44 (permalink)
0
Hello,
 
The button effect to not trigger a release is expected behavior; it seems like you think so too.
 
So if the question is what image is show, are we talking before you lift your touch, or while still touched down.  I think our intended behavior is that when you lift off the image would be "released" or not pressed.  What would you expect it to do?
#2
bblessing
Super Member
  • Total Posts : 473
  • Reward points : 0
  • Joined: 2008/12/04 06:44:21
  • Location: Cincinnati, OH
  • Status: offline
Re: Button issue 2017/10/06 07:52:49 (permalink)
0
Suppose you're pressing a button and holding the button. The pressed state will be shown and the pressed event fired (once to my knowledge). If you let go, but where you were pressing is within the bounds of the button, a released event will fire and the released state will be shown. If you slide your finger, while still pressing down on the display, outside of the bounds of the button, and then let go, the released state will be shown but the released event will NOT fire. This cannot be correct because the button itself acknowledges that a release occurred and so the released event should fire.
 
This is a problem because our users will expect to be able to push and hold a button to start a motor opening and then release to stop it. If they accidentally release outside of the bounds of the button then the motor will continue to open, even though the user thought that they released the button.
#3
MHGC
Super Member
  • Total Posts : 165
  • Reward points : 0
  • Status: offline
Re: Button issue 2017/10/06 09:48:53 (permalink) ☼ Best Answerby bblessing 2017/10/06 10:14:32
5 (2)
Hi,
 
It is standard GUI button behavior for the release event not to fire when the finger has slide outside of the button.  It's a way for the user to cancel his request at the last possible moment.
 
That said, I understand the necessity of your use case.  And it can be easily solved by having the button as a child to a panel widget.  The panel widget should be invisible but covers around the button.  If you override the touchUp event of the panel widget by calling laWidget_OverrideTouchUpEvent and have the callback routed to the same code that stops the motor, you should get the behavior you desire.
#4
bblessing
Super Member
  • Total Posts : 473
  • Reward points : 0
  • Joined: 2008/12/04 06:44:21
  • Location: Cincinnati, OH
  • Status: offline
Re: Button issue 2017/10/06 09:59:35 (permalink)
0
MHGC,
 
    Thank you!!! I was actually attempting to do just that, but with the main panel for that particular display, though it was wasn't working so well.
#5
rbmisc
Starting Member
  • Total Posts : 73
  • Reward points : 0
  • Joined: 2017/07/19 08:22:06
  • Location: 0
  • Status: offline
Re: Button issue 2017/12/04 05:41:37 (permalink)
0
I'm having the same issue as bblessing. I put a button into a panel and then I overrode the touchup event for this panel to callback the released event for this button, but I'm not seeing the released event for this button to occur.  I see the pressed event happening but not the released. So what am I doing wrong?
Here is the instruction I've implemented.
laWidget_OverrideTouchUpEvent((laWidget*)ButtonPanel, (laWidget_TouchUpEvent_FnPtr)Button_ReleasedEvent);
 
 
post edited by rbmisc - 2017/12/04 06:48:22
#6
jcandle
Super Member
  • Total Posts : 218
  • Reward points : 0
  • Joined: 2011/09/19 22:01:53
  • Location: 0
  • Status: offline
Re: Button issue 2017/12/07 05:59:01 (permalink)
0
to MHGC's point, Qt does this as well (and i imagine most GUI's).  The workaround to override it sounds useful. 
 
It could also be useful to add a test if the finger moves out and back in while pressed (eg a mistaken motion or a noisy RTP) and *still* get the pressed + released == clicked.  
#7
Jump to:
© 2017 APG vNext Commercial Version 4.5