It is currently May 8th, 2024, 10:33 pm

LeftMouseDown vs DoubleClick Actions

Get help with creating, editing & fixing problems with skins
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

LeftMouseDown vs DoubleClick Actions

Post by brijamelsh »

Hey guys,

So I'm trying to get 2 different actions, one for LeftMouseDown and the other for LeftMouseDoubleClick. The problem I'm running into is fairly obvious. When I double click, it reads the first click as LeftMouseDown and executes the bang for that then the bang for the double click.

Is there anyway to have it read the double-click without reading the single click first?

Any tips or workarounds would be appreciated.
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: LeftMouseDown vs DoubleClick Actions

Post by JpsCrazy »

Well.
It may not be exactly what you'd want, but you could use MiddleMouseDown/RightMouseDown.

Or a simple(?) workaround.
Instead of having LeftMouseDown do an action, have it set a variable to say, 1.
LeftMouseDoubleClick have it appropiately set a variable to 2.

Then a calc, with an UpdateDivider, reads the variable and then does the action.

Ex:

Code: Select all

[Variables]
Action=0

[meter]
Meter=Image
LeftMouseDownAction=!RainmeterSetVariable Action 1
LeftMouseDoubleClick=!RainmeterSetVariable Action 2

[calc]
Measure=Calc
Formula=#Action#
UpdateDivider=3
IfAboveValue=1
IfAboveAction=*DoubleClickAction*
IfBelowValue=2
IfBelowAction=*LeftClickAction*
IfEqualValue=0
IfEqualAction=*NegateIfBelowAction*
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

Re: LeftMouseDown vs DoubleClick Actions

Post by brijamelsh »

wouldn't that still do the action for down and double when you double click?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: LeftMouseDown vs DoubleClick Actions

Post by jsmorley »

brijamelsh wrote:wouldn't that still do the action for down and double when you double click?
If you have both down/up and doubleclick defined for a single mouse button, they will always both fire. Don't.
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

Re: LeftMouseDown vs DoubleClick Actions

Post by brijamelsh »

I feel a feature suggestion coming on...
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: LeftMouseDown vs DoubleClick Actions

Post by JpsCrazy »

jsmorley wrote:If you have both down/up and doubleclick defined for a single mouse button, they will always both fire. Don't.
Okay. I can accept this. But it's kind of bothering me there's no workaround for this. I had an idea, and as of right now it's not working. Basically, LeftMouseDownAction adds 1 to a variable. So, you click once and it's 1, twice and it's 2.
Of course, as of right now you get stuck at 2, and can't go back but that's nothing I'm worried about as of now.

Example:

Code: Select all

[Rainmeter]
Update=500

[Variables]
Clicks=0
Color=000000

[mtImage]
Meter=Image
SolidColor=#Color#
DynamicVariables=1
W=30
H=30
LeftMouseUpAction=!Execute [!RainmeterSetVariable Clicks (#Clicks#+1)]

[msCalcAction]
Measure=Calc
Formula=#Clicks# = 2 ? 3 : #Clicks# = 0 ? 2 : 1
DynamicVariables=1
UpdateDivider=6
IfAboveValue=2
IfAboveAction=!RainmeterSetVariable Color FFFFFF
IfEqualValue=2
IfEqualAction=!RainmeterSetVariable Color 000000
IfBelowValue=2
IfBelowAction=!RainmeterSetVariable Color 505050
The idea is that 2 clicks gives a value of 3, 1 gives a value of 1 and 0 gives a value of two. Therefore, the IfEqualValue is the standard of 2 (which is actually 0), 1 click would be anything below 2, and two clicks would be anything above 2.

Am I doing something wrong, or is this concept just not possible?
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

Re: LeftMouseDown vs DoubleClick Actions

Post by brijamelsh »

Just an idea, to get around the "being stuck at 2" scenario, you might be able to reset the value every update cycle. if the update cycle is only a second or 2, it should work quite nicely.
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: LeftMouseDown vs DoubleClick Actions

Post by JpsCrazy »

brijamelsh wrote:Just an idea, to get around the "being stuck at 2" scenario, you might be able to reset the value every update cycle. if the update cycle is only a second or 2, it should work quite nicely.
Thing is, if it's like a drop down menu (just as an example) it might dissappear before you'd like it to.
Again, it wouldn't be a huge problem to fix, just I was wondering if the inital concept would work.
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

Re: LeftMouseDown vs DoubleClick Actions

Post by brijamelsh »

makes sense to me, but im no expert on that part of the code yet, still getting there.
Kryptonite
Posts: 6
Joined: June 13th, 2012, 7:42 am

Re: LeftMouseDown vs DoubleClick Actions

Post by Kryptonite »

I can't offer a solution to this problem as I'm having the same issue. I have created a skin which has many image icons that have sounds and hyperlinks associated with them. If you click once on a particular icon it starts a voice sound file that tells the user what it is and what it does. A doubleclick on that icon would then take the user to a music or video site (youtube for example). I have created this skin for people who have learning difficulties (low levels of literacy) and want/need to keep the mouse interactions straightforward.

The problem is that the double click action also starts the sound file again (sometimes it runs twice (due to the double click procedure taken as two single clicks)). This is confusing to the people I'm supporting and so would like to avoid this if possible. I initially used the mouseover bang to start a sound file (instead of leftmouseupaction) but this causes sound files to be played as the mouse moves around the screen (so quite anoying an confusing for the user). Using the middle or right mouse buttons would only add complication to the people I'm helping.

I hope someone can find a workable solution to this. I did try and use the code written by JpsCrazy but nothing really happend. :confused: