It is currently March 29th, 2024, 12:04 pm

MouseOverAction not properly working

Get help with creating, editing & fixing problems with skins
Horatius
Posts: 4
Joined: March 25th, 2018, 7:35 am

MouseOverAction not properly working

Post by Horatius »

Hey,

So I have been trying to create my self-made skin as the ones that currently are available don't meet my needs. I want to have a circle, and when I hover over it, I want to change the opacity of the icons that are in it, doesn't sound so hard and should be pretty easy. But I cannot get it to work :). Hence I ask here if you can help me where my mistake lies.
Currently, I can adjust the ImageAlpha through the variable IconOpacity, but the MouseOverAction doesn't change the IconOpacity. Any idea why this is not working?
The Code
[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=
Author=
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
IconOpacity=100

[MeterString]
Meter=String

[Meter]
Meter=Roundline
W=800
H=800
RotationAngle=(Rad(360))
LineLength=400
LineColor=146,222,148,1
Solid=1
AntiAlias=1
MouseOverAction=[!SetOption #Variables# IconOpacity "255"][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction=[!SetOption #Variables# IconOpacity "1"][!UpdateMeter #CURRENTSECTION#][!Redraw]

[Icon1]
Meter=Image
Group=Icons
X=128
Y=16
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#

Thanks in advance
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: MouseOverAction not properly working

Post by mak_kawa »

Haven't tried your code actually, but I think...

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
IconOpacity=100

[Meter]
Meter=Roundline
W=800
H=800
RotationAngle=(Rad(360))
LineLength=400
LineColor=146,222,148,1
Solid=1
AntiAlias=1
MouseOverAction=[!SetVariable IconOpacity "255"][!UpdateMeter Icon1][!Redraw]
MouseLeaveAction=[!SetVariable IconOpacity "1"][!UpdateMeter Icon1][!Redraw]

[Icon1]
Meter=Image
Group=Icons
X=128
Y=16
H=100
W=100
ImageName==#@#eth.png
ImageAlpha=#IconOpacity#
DynamicVariables=1
Horatius
Posts: 4
Joined: March 25th, 2018, 7:35 am

Re: MouseOverAction not properly working

Post by Horatius »

mak_kawa wrote:Haven't tried your code actually, but I think...

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
IconOpacity=100

[Meter]
Meter=Roundline
W=800
H=800
RotationAngle=(Rad(360))
LineLength=400
LineColor=146,222,148,1
Solid=1
AntiAlias=1
MouseOverAction=[!SetVariable IconOpacity "255"][!UpdateMeter Icon1][!Redraw]
MouseLeaveAction=[!SetVariable IconOpacity "1"][!UpdateMeter Icon1][!Redraw]

[Icon1]
Meter=Image
Group=Icons
X=128
Y=16
H=100
W=100
ImageName==#@#eth.png
ImageAlpha=#IconOpacity#
DynamicVariables=1
That didn't work but I do think the mistake is in changing the variable.
I changed the code to make it more clear what is happening, and I cannot even change the color of the circle with mouseover, so the problem has to lay in that area.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=
Author=
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
IconOpacity=100

[MeterString]
Meter=String

[Meter]
Meter=Roundline
W=800
H=800
RotationAngle=(Rad(360))
LineLength=400
LineColor=146,222,148,#IconOpacity#

Solid=1
AntiAlias=1
MouseOverAction=[!SetOption IconOpacity "255"][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction=[!SetOption IconOpacity "1"][!UpdateMeter #CURRENTSECTION#][!Redraw]


[Icon1]
Meter=Image
Group=Icons
X=128
Y=16
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: MouseOverAction not properly working

Post by fonpaolo »

Just a few notes...
First, why do you have a IconOpacity variable and then you change it via !SetVariable?
You can do it in this way:

Code: Select all

[Icon1]
Meter=Image
Group=Icons
X=128
Y=16
H=100
W=100
ImageName==#@#eth.png
ImageAlpha=100
;DynamicVariables=1
Second, to change opacity, simply change your Meter:

Code: Select all

[Meter]
Meter=Roundline
W=800
H=800
RotationAngle=(Rad(360))
LineLength=400
LineColor=146,222,148,1
Solid=1
AntiAlias=1
MouseOverAction=[!SetOption IconOpacity "255"]
MouseLeaveAction=[!SetOption IconOpacity "1"]
In this way, you don't need a variable and even DynamicVariables=1.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MouseOverAction not properly working

Post by balala »

Horatius wrote:That didn't work
Yes, it doesn't work, because mak_kawa's code has a small mistake: there are two equality signs in the ImageName option of the [Icon1] meter: ImageName=[color=#FF0000]=[/color]#@#eth.png. Remove one of them and the code will start to work.

On the other hand, mak_kawa modified the original code properly. If you want to change the value of a variable, don't use the !SetOption bang, but use !SetVariable. That's why he rewrote the MouseOverAction and MouseLeaveAction options of the [Meter] meter, to use the !SetVariable bang:
mak_kawa wrote:

Code: Select all

...
[Meter]
...
MouseOverAction=[!SetVariable IconOpacity "255"][!UpdateMeter Icon1][!Redraw]
MouseLeaveAction=[!SetVariable IconOpacity "1"][!UpdateMeter Icon1][!Redraw][/quote]
Beside this, you have to know that if you're setting a variable through the !SetVariable bang, you have to add a [snippet]DynamicVariables=1[/snippet] option to the section (more precisely meter or measure) where the newly set variable will be used. In this case, to the [Icon1] meter. He did add this option there.
Horatius
Posts: 4
Joined: March 25th, 2018, 7:35 am

Re: MouseOverAction not properly working

Post by Horatius »

balala wrote:Yes, it doesn't work, because mak_kawa's code has a small mistake: there are two equality signs in the ImageName option of the [Icon1] meter: ImageName=[color=#FF0000]=[/color]#@#eth.png. Remove one of them and the code will start to work.

On the other hand, mak_kawa modified the original code properly. If you want to change the value of a variable, don't use the !SetOption bang, but use !SetVariable. That's why he rewrote the MouseOverAction and MouseLeaveAction options of the [Meter] meter, to use the !SetVariable bang:

Beside this, you have to know that if you're setting a variable through the !SetVariable bang, you have to add a DynamicVariables=1 option to the section (more precisely meter or measure) where the newly set variable will be used. In this case, to the [Icon1] meter. He did add this option there.
THANKS!, it works. I didn't know about the SetVariable and DynamicVariable. Now I can go on to customize it. Lovely community and program built here.


Edit:
I still have 1 more question and didn't want to open another topic.
I want to load in more icons but when I add the second icon sometimes there is a delay up to a whole second before the second icon displays.
The code I used to add another icon was just by adding MouseLeaveAction=[!SetVariable IconOpacity "1"][!UpdateMeter Icon1][!UpdateMeter Icon2][!Redraw]
Any reason why there is such a huge delay before it gets displayed?
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: MouseOverAction not properly working

Post by fonpaolo »

First of all, I have to correct a little mistake I did:

Code: Select all

[Meter]
Meter=Roundline
W=800
H=800
RotationAngle=(Rad(360))
LineLength=400
LineColor=146,222,148,1
Solid=1
AntiAlias=1
MouseOverAction=[!SetOption Icon1 IconOpacity "255"]
MouseLeaveAction=[!SetOption Icon1 IconOpacity "1"]
..because I forgot to add the meter affected by this change, when I edited your code.

For your last question, have you added DynamicVariables=1 to your Icon2 meter?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MouseOverAction not properly working

Post by balala »

Horatius wrote:Edit:
I still have 1 more question and didn't want to open another topic.
I want to load in more icons but when I add the second icon sometimes there is a delay up to a whole second before the second icon displays.
The code I used to add another icon was just by adding MouseLeaveAction=[!SetVariable IconOpacity "1"][!UpdateMeter Icon1][!UpdateMeter Icon2][!Redraw]
Any reason why there is such a huge delay before it gets displayed?
Post please the whole code, with both icons.
Horatius
Posts: 4
Joined: March 25th, 2018, 7:35 am

Re: MouseOverAction not properly working

Post by Horatius »

I found a simple solution to all my problems. I decreased the update timer which reduced the lag between the icons and just removed the icon updated and included DynamicVariables=1.

This is my code now

Code: Select all

[Rainmeter]
Update=150
AccurateText=1

[Metadata]
Name=
Author= Horatius
Information=
Version= 0.1
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
IconOpacity=1
I=1

[MeterString]
Meter=String

[Meter]
Meter=Roundline
W=800
H=800
RotationAngle=(Rad(360))
LineLength=400
LineColor=146,222,148,1

Solid=1
AntiAlias=1
MouseOverAction=[!SetVariable IconOpacity "200"][!Redraw]
MouseLeaveAction=[!SetVariable IconOpacity "1"][!Redraw]
DynamicVariables=1
FadeDuration=255
UpdateDivider=1

[Icon1]
Meter=Image
Group=Icons
X=360
Y=12
H=100
W=100
ImageName=#@#firefox.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw
MouseOverAction=[!SetOption #CURRENTSECTION# W 500] [!SetOption #CURRENTSECTION# H 500] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction="https://www.google.com/"
DynamicVariables=1

[Icon2]
Meter=Image
Group=Icons
X=501
Y=51
H=80
W=80
ImageName=#@#steam.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction=""C:\Program Files (x86)\Steam\Steam.exe""
DynamicVariables=1

[Icon3]
Meter=Image
Group=Icons
X=602
Y=135
H=80
W=80
ImageName=#@#warband.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction="steam://rungameid/48700"
DynamicVariables=1

[Icon4]
Meter=Image
Group=Icons
X=660
Y=243
H=80
W=80
ImageName=#@#fuji injector.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction="D:\Cheats\Uitgezonderd\Injector.exe"
DynamicVariables=1

[Icon5]
Meter=Image
Group=Icons
X=675
Y=360
H=80
W=80
ImageName=#@#aco.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction="D:\Games\Assassin's Creed Origins\ACOrigins.exe"
DynamicVariables=1

[Icon6]
Meter=Image
Group=Icons
X=648
Y=475
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction="D:\claymore\start_only_eth.bat"
DynamicVariables=1

[Icon7]
Meter=Image
Group=Icons
X=587
Y=568
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction=#Icon1Action#
DynamicVariables=1

[Icon8]
Meter=Image
Group=Icons
X=485
Y=643
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction=#Icon1Action#
DynamicVariables=1

[Icon9]
Meter=Image
Group=Icons
X=360
Y=675
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction=#Icon1Action#
DynamicVariables=1

[Icon10]
Meter=Image
Group=Icons
X=233
Y=656
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction=#Icon1Action#
DynamicVariables=1

[Icon11]
Meter=Image
Group=Icons
X=121
Y=590
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction=#Icon1Action#
DynamicVariables=1

[Icon12]
Meter=Image
Group=Icons
X=44
Y=486
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction=#Icon1Action#
DynamicVariables=1
[Icon13]
Meter=Image
Group=Icons
X=12
Y=360
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction=#Icon1Action#
DynamicVariables=1

[Icon14]
Meter=Image
Group=Icons
X=37
Y=215
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction=#Icon1Action#
DynamicVariables=1

[Icon15]
Meter=Image
Group=Icons
X=115
Y=118
H=100
W=100
ImageName=#@#eth.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction=#Icon1Action#
DynamicVariables=1

[Icon16]
Meter=Image
Group=Icons
X=222
Y=43
H=100
W=100
ImageName=#@#thunderbird.png
ImageAlpha=#IconOpacity#
ImageTint=200,200,200
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint "255,255,255"] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint "200,200,200"] [!Redraw]
LeftMouseUpAction=""C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe""
DynamicVariables=1
Full circle with 16 icons which light up when you hover over them, to adjust circle size change the linelenght and recalculate the icons by making the circle in a graphing progam so you can measure where each icon should be.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MouseOverAction not properly working

Post by balala »

Horatius wrote:I found a simple solution to all my problems. I decreased the update timer which reduced the lag between the icons and just removed the icon updated and included DynamicVariables=1.
Usually (and in this case for sure) doesn't worth to reduce the Update so much, because this can lead to growth the CPU usage. But usually this isn't even required, there could exist better solutions.
So, please again, if you'd like us to take a look, please post the previous code, with the delay.