So I added a feature to my buttons where holding control brings up a nice description of the button to help users understand what the buttons are/do. Presumably few users on android or iOS are going to have a control key to conveniently press so I figure I want to make the text descriptions pop up if the user holds their finger down on the button in a long-press style similar to selecting particular icons to move around on your home screen. My other issue is I need to not trigger a simple click if the user does long-press a button.
Best way to detect long-press?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Best way to detect long-press?
Add a timer to the button and reset it if the player stops pressing it or if he moves the mouse/finger off the button. For a normal click use a shorter timer that triggers if the player stops pressing the button. See the attached code for an example.
- Attachments
-
- long_press.love
- (854 Bytes) Downloaded 90 times
Re: Best way to detect long-press?
If I hadn't knew there's such a feature in the demo, I would have never waited for *that* long to trigger a "long press".
While Xugro gave a perfectly working solution, I must admit that a long press is counterintuitive:
While Xugro gave a perfectly working solution, I must admit that a long press is counterintuitive:
- What timer values should one use?
For how long should be a button held to trigger a "long press" event? - What if user isn't quite so quick?
For a moderate long-press timer values, there might be those who simply can't react quick enough to stop pressing a button *before* button will decide that's a "long press". - How to make one acknowledge there is such a feature as a "long press"?
Making another "welcome, I'll tell you how to use me, 'cause my interface is not that intuitive as the ads said" screen is a *bad* option. Few like to read forced tutorials. Few like when instead letting use itself, the app pops some messages.
- zorg
- Party member
- Posts: 3444
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Best way to detect long-press?
In my opinion, timeout values should be configurable (i.e. maximum time for short press detection, or at least minimum time for long press detection) and also, some visual feedback is always nice, like have a circular bar slowly filling while holding the button, or something similar.
The last bullet point is really important though, and yet, i know quite a few apps myself that "hide" additional options "in plain sight". I don't know of one general solution for this sadly. Still, if the OP supports tooltips, he can just state both functions for a button, one for "short" press, and one for the "long" held down version.
The last bullet point is really important though, and yet, i know quite a few apps myself that "hide" additional options "in plain sight". I don't know of one general solution for this sadly. Still, if the OP supports tooltips, he can just state both functions for a button, one for "short" press, and one for the "long" held down version.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
-
- Citizen
- Posts: 87
- Joined: Tue Dec 30, 2014 6:07 pm
Re: Best way to detect long-press?
Do you think global for-all-buttons is the best way to have the config? I don't want users to have to manually config each and every button's timing, though perhaps maybe there could be two sets, one for menu-y buttons that you usually want to single click but don't really care if you mispress and then maybe ingame ones where you'd really want to avoid long pressing them by mistake and don't care if long pressing them takes a whole second.
I currently use meshes to add a little colour overlay on the bottom of the images whenever the user clicks the buttons with their corresponding key or rolls over with the mouse. On that note I need to add the key combinations to the overlay tooltip so it's not hidden xD. But yeah I can probably work in another mesh effect for the user holding down a click on the buttons to provide a good visual cue so it's not so hidden.
Yup the buttons contain a function they call when clicked that other code specifies so that part is easy at least.
I currently use meshes to add a little colour overlay on the bottom of the images whenever the user clicks the buttons with their corresponding key or rolls over with the mouse. On that note I need to add the key combinations to the overlay tooltip so it's not hidden xD. But yeah I can probably work in another mesh effect for the user holding down a click on the buttons to provide a good visual cue so it's not so hidden.
Yup the buttons contain a function they call when clicked that other code specifies so that part is easy at least.
Who is online
Users browsing this forum: Bing [Bot] and 82 guests