Mouse click and Mouse double click in the same button?

Q&A about the latest versions
Post Reply
jose maria
Posts: 41
Joined: Mon Jun 01, 2020 11:45 am

Hello,

I want to set a button that performs two different actions depending on a single or double mouse click.
The problem is that the single mouse click triggers always. With the single and double mouse clicks.

Is it possible to isolate both actions?. I have tried changing the order of the actions but it does not work.
User avatar
Hopki
Gnome
Posts: 13029
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi jose maria,
Yes, you can do this, you need a button, a timer and a variable.

Please see the attached project.
1) The skin has a variable, var_click, true/false set to false.
2) The timer, SingleClickTimer has the action Deactivate, Toggle Element Position, 100px with the action filter to only do this if the variable, var_click = false.

So that's the setup. The "Button" which will be clicked or double-clicked has the actions:
• Mouse Click, Set Variable Value, false, var_click
• Mouse Double-Click, Set Variable Vale, true, var_click
• Mouse Clock, Set Value, 0.5, SingleClickTimer
• Mouse Double-Click, Toggle Element Position, 100, MoveTwo

So on a single click, the variable is at false and 0.35 seconds is added to the timer.
When the timer deactivates, it will trigger the action Deactivate, Toggle Element Position, 100, MoveOne, the action filter states the variable has to be false for this to happen.
So the text box, MoveOne moves.

On Double click, the variable is set to true and action, Toggle Element Position, 100, MoveTwo, triggers, so the text box MoveTwo, moves.
As the variable is set to true, the Deactivate action in the timer can not trigger due to the action filter.
Regards,
Attachments
click.zip
(12.63 KiB) Downloaded 148 times
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
jose maria
Posts: 41
Joined: Mon Jun 01, 2020 11:45 am

Thank you very much for your answer.
I will try it
User avatar
Tony
Posts: 1342
Joined: Mon Feb 15, 2010 6:54 am
Location: Adelaide, South Australia
Contact:

Hi,

Like that, very nice.

Tony
Tony Redhead | Panoramic Photographer | mobile: +61438501002 | website: https://tonyredhead.com - https://redsquare.com | Pano2VR Tutorials: https://tonyredhead.com/pano2vr | instagram: https://www.instagram.com/tonyredhead/
User avatar
Hopki
Gnome
Posts: 13029
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

:D
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
Post Reply