It is currently March 28th, 2024, 2:35 pm

Can you set a delay before MouseOverAction?

Get help with creating, editing & fixing problems with skins
anagrammar
Posts: 2
Joined: April 27th, 2015, 2:15 am

Can you set a delay before MouseOverAction?

Post by anagrammar »

Not that familiar with Rainmeter. I made a little widget that opens my clipboard manager when hovered which works fine. What I haven't been able to figure out is how to set a delay before MouseOverAction kicks in. Just like 2-3 seconds so it doesn't execute when accidentally moused over. This is the code I pieced together from Google:

[Rainmeter]
Update=1000

[Arslauncher]
Meter=Image
ImageName=ac5.png
MouseOverAction=C:\Users\D\acv420\ArsClip.exe -popup

Like I said, it works, but it's probably not technically correct. Any help would be greatly appreciated.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can you set a delay before MouseOverAction?

Post by balala »

To set a delay, add this measure to your code:

Code: Select all

[Timer]
Measure=Calc
Formula=( Timer + 1 )
Disabled=1
IfCondition=(Timer=5)
IfTrueAction=[!DisableMeasure "Timer"][C:\Users\D\acv420\ArsClip.exe -popup]
and these mouse actions to the [Arslauncher] meter:

Code: Select all

MouseOverAction=[!EnableMeasure "Timer"]
MouseLeaveAction=[!DisableMeasure "Timer"]
Note that in the Timer=5 condition (IfCondition in [Timer] measure), 5 is the delay, use the desired value.
anagrammar
Posts: 2
Joined: April 27th, 2015, 2:15 am

Re: Can you set a delay before MouseOverAction?

Post by anagrammar »

Worked like a charm. Thank you very much.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can you set a delay before MouseOverAction?

Post by balala »

I'm glad.
User avatar
MrZexx
Posts: 8
Joined: July 28th, 2023, 5:06 pm

Re: Can you set a delay before MouseOverAction?

Post by MrZexx »

Can You Please bend the code? So that When Ever I Hover Over the [MeterShape1] for atleast for 3 seconds the [Tip] text should be displayed.

Code: Select all

[Rainmeter]
Update=10
AccurateText=1

[Metadata]
Name= MonoChromatic Forest
Author= Mr. Zexx
Information= A Firewatch out tower in the middle of a Forest.
Version= 1.0

[ReFresh]
Meter=Plugin
Plugin=Hotkey
Hotkey= CRTL R
KeyDownAction=[!Refresh]

[MeasureSettings]
Measure=Plugin
Plugin=HotKey
HotKey=SHIFT ALT S
KeyDownAction=["shell:Appsfolder\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel"]

[Timer]
Measure=Calc
Formula=( Timer + 1 )
Disabled=1
IfCondition=(Timer=5)
IfTrueAction=[!DisableMeasure "Timer"][C:\Users\D\acv420\ArsClip.exe -popup]

[MeterShape1]
Meter=Shape
Shape=Rectangle 36,36,36,36 | FillColor 255,255,255,1 | StrokeWidth 0
MouseOverAction=[!EnableMeasure "Timer"]
MouseLeaveAction=[!DisableMeasure "Timer"]
DynamicVaribles=1
X=-29
Y=-29

[Tip]
Meter=String
FontFace=Galyon Bold
FontColor=255,255,255,255
FontFace=Galyon Bold 
FontSize=12
StringAlign=Left
Text="Settings"
X=0
Y=29
Hidden=1
DynamicVariables=1
AntiAlias=1

[MeterSettings]
Meter=Image
Meter2=String
ImageName=#@#/Icons/settings.png
W=50
LeftMouseUpAction=["shell:Appsfolder\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel"]
DynamicVariables=1
Antialias=1
You can change the code to use ToolTipText but with the delay.
User avatar
Yincognito
Rainmeter Sage
Posts: 7022
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Can you set a delay before MouseOverAction?

Post by Yincognito »

MrZexx wrote: July 28th, 2023, 5:21 pmSo that When Ever I Hover Over the [MeterShape1] for atleast for 3 seconds the [Tip] text should be displayed.
I'm pretty sure some of the things in your existing code are a bit redundant to begin with (e.g. typos, inconsistent positioning, code for a different user with different files, etc.) and you'll probably want to correct them in the future, but to do what you want:
- change the skin Update from 10 to 1000 milliseconds (this is why it didn't wait 3 x 1000 milliseconds as desired, but 3 x 10 milliseconds)
- change to (Timer=3) in the IfCondition option (obviously, since you want at least 3 and not 5 seconds before the Tip is displayed)
- add [!ShowMeter Tip][!Redraw] to the IfTrueAction (to show the Tip once the Timer reaches the 3 seconds)
- add [!HideMeter Tip][!Redraw] to the MouseLeaveAction (to hide the Tip once mouse leaves the MeterShape1 area)
That would be it. Oh, and read these few lines here and here to understand why you had to do the above. If you want to know the next time you encounter something similar, of course.
User avatar
MrZexx
Posts: 8
Joined: July 28th, 2023, 5:06 pm

Re: Can you set a delay before MouseOverAction?

Post by MrZexx »

Thank you a lot.
And can you please mention the typos, and positionings as you mentioned.
Last edited by MrZexx on July 28th, 2023, 7:08 pm, edited 1 time in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 7022
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Can you set a delay before MouseOverAction?

Post by Yincognito »

MrZexx wrote: July 28th, 2023, 7:04 pm Thank you a lot
You're welcome - glad to help. ;-)
User avatar
MrZexx
Posts: 8
Joined: July 28th, 2023, 5:06 pm

Re: Can you set a delay before MouseOverAction?

Post by MrZexx »

Yincognito wrote: July 28th, 2023, 7:07 pm You're welcome - glad to help. ;-)
Can you please mention the typos and the inconsistent positions. It will be really helpful.
User avatar
Yincognito
Rainmeter Sage
Posts: 7022
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Can you set a delay before MouseOverAction?

Post by Yincognito »

MrZexx wrote: July 28th, 2023, 7:17 pm Can you please mention the typos and the inconsistent positions. It will be really helpful.
Sure thing.
Typos:
- DynamicVaribles=1, should be DynamicVariables=1
Files:
- C:\Users\D\acv420\ArsClip.exe -popup, not sure you have this, unless you're the same user as the OP from 2015
Positions:
- X=-29, Y=-29, since negative positions are invalid in Rainmeter, you might want to get rid of them to place the shape at 0,0 and just make Rectangle 7,7,36,36 | ...instead
- the Tip meter needs to be placed a bit lower, so its Y should be at least 36+7 aka 43 (unless, of course, the font has a huge blank space at the top to justify the Y=29 positioning)
- you'd probably want the shape and the image to have the same width and height in case the image doesn't have significant transparent margins, so the above could probably warrant corresponding adjustment

That's about it. Obviously, I don't have your image, so I can't tell for sure how it would look, but by looking at the code, these are the obvious inconsistencies.
Post Reply