It is currently April 23rd, 2024, 4:12 pm
Get help with creating, editing & fixing problems with skins
pul53dr1v3r
Posts: 442 Joined: July 30th, 2014, 10:30 am
Post
by pul53dr1v3r » August 20th, 2019, 5:18 pm
Hi. I need some help to make the button returns the defined colors in
[MeasureBatteryLauncher] measure according to the skin state, when the mouse leaves the button region.
So, the text should be always red when the state is 1 (when mouse is over as well), and when the state is 0 it should be red only when the mouse is over it.
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
MiddleMouseDownAction=[!RefreshApp]
Group=#RootConfig#
[Variables]
ActivatedSkinColor=105,105,105
ActivatedSkinTxtColor=255,0,0
DeactivatedSkinColor=64,64,64
DeactivatedSkinTxtColor=120,120,120
FontFamily=Trebuchet MS
[styleButtonsBoxes]
StringCase=UPPER
StringStyle=Bold
FontColor=#DeactivatedSkinTxtColor#
SolidColor=64,64,64,250
W=99
H=21
FontFace=#FontFamily#
FontSize=9
AntiAlias=1
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor #ActivatedSkinTxtColor#][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor #DeactivatedSkinTxtColor#][!UpdateMeter #CURRENTSECTION#][!Redraw]
[MeasureBatteryLauncher]
Measure=Plugin
Plugin=ConfigActive
ConfigName=#ROOTCONFIG#\Battery
IfCondition=(#CURRENTSECTION#>=1)
IfTrueAction=[!SetOption MeterBatteryLauncher LeftMouseUpAction """[!DeactivateConfig "#ROOTCONFIG#\Battery"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#ActivatedSkinColor#"][!SetOption MeterBatteryLauncher FontColor "#ActivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterBatteryLauncher LeftMouseUpAction """[!ActivateConfig "#ROOTCONFIG#\Battery" "Battery.ini"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#DeactivatedSkinColor#"][!SetOption MeterBatteryLauncher FontColor "#DeactivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
[MeterBatteryLauncher]
Meter=String
MeterStyle=styleButtonsBoxes
StringAlign=CenterCenter
X=80
Y=10
Text=Battery
Last edited by pul53dr1v3r on August 23rd, 2019, 12:53 pm, edited 1 time in total.
jsmorley
Developer
Posts: 22629 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » August 20th, 2019, 5:39 pm
Something like this perhaps:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
Over=0
StateColor=255,255,255,255
State0=255,255,255,255
State1=255,0,0,255
[MeasureState]
Measure=Calc
; Test by changing to Formula=1
Formula=0
DynamicVariables=1
IfCondition=(#Over# = 1)
IfTrueAction=[!SetVariable StateColor "#State1#"][!UpdateMeter *][!Redraw]
IfCondition2=(#Over# = 0) && (MeasureState = 0)
IfTrueAction2=[!SetVariable StateColor "#State0#"][!UpdateMeter *][!Redraw]
IfCondition3=(#Over# = 0) && (MeasureState = 1)
IfTrueAction3=[!SetVariable StateColor "#State1#"][!UpdateMeter *][!Redraw]
[MeterOne]
Meter=Image
W=100
H=100
SolidColor=#StateColor#
DynamicVariables=1
MouseOverAction=[!SetVariable Over "1"][!UpdateMeasure MeasureState]
MouseLeaveAction=[!SetVariable Over "0"][!UpdateMeasure MeasureState]
pul53dr1v3r
Posts: 442 Joined: July 30th, 2014, 10:30 am
Post
by pul53dr1v3r » August 20th, 2019, 8:16 pm
Ok, i applied it to my example and it does the job but it's not so fast at all because of using ConfigActive plug-in in the calculation, i believe:
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
MiddleMouseDownAction=[!RefreshApp]
Group=#RootConfig#
[Variables]
ActivatedSkinColor=105,105,105
ActivatedSkinTxtColor=255,0,0
DeactivatedSkinColor=64,64,64
DeactivatedSkinTxtColor=120,120,120
FontFamily=Trebuchet MS
SkinTxtColor=105,105,105
MOver=1
[styleSkinsBoxes]
StringCase=UPPER
StringStyle=Bold
FontColor=#SkinTxtColor#
SolidColor=64,64,64,250
W=99
H=21
FontFace=#FontFamily#
FontSize=9
AntiAlias=1
MouseOverAction=[!SetVariable MOver "1"][!UpdateMeasure MeasureBatteryLauncher]
MouseLeaveAction=[!SetVariable MOver "0"][!UpdateMeasure MeasureBatteryLauncher]
DynamicVariables=1
[MeasureBatteryLauncher]
Measure=Plugin
Plugin=ConfigActive
ConfigName=#ROOTCONFIG#\Battery
IfCondition=(#CURRENTSECTION# = 1)
IfTrueAction=[!SetOption MeterBatteryLauncher LeftMouseUpAction """[!DeactivateConfig "#ROOTCONFIG#\Battery"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#ActivatedSkinColor#"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterBatteryLauncher LeftMouseUpAction """[!ActivateConfig "#ROOTCONFIG#\Battery" "Battery.ini"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#DeactivatedSkinColor#"][!UpdateMeter *][!Redraw]
[MeasureState]
Measure=Calc
Formula=MeasureBatteryLauncher
IfCondition=(#CURRENTSECTION# = 1)
IfTrueAction=[!SetVariable SkinTxtColor "#ActivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfCondition2=(#CURRENTSECTION# <= 0) && (#MOver# <= 0)
IfTrueAction2=[!SetVariable SkinTxtColor "#DeactivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfCondition3=(#CURRENTSECTION# <= 0) && (#MOver# = 1)
IfTrueAction3=[!SetVariable SkinTxtColor "#ActivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
DynamicVariables=1
[MeterBatteryLauncher]
Meter=String
MeterStyle=styleSkinsBoxes
StringAlign=CenterCenter
X=80
Y=10
Text=Battery
ikarus1969
Posts: 571 Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria
Post
by ikarus1969 » August 21st, 2019, 6:29 am
i have rearranged the code a little bit and update measures only when they are needed to. The plugin has nothing to do with the slow color-change.
Just give it a try.
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
MiddleMouseDownAction=[!RefreshApp]
Group=#RootConfig#
[Variables]
ActivatedSkinColor=105,105,105
ActivatedSkinTxtColor=255,0,0
DeactivatedSkinColor=64,64,64
DeactivatedSkinTxtColor=120,120,120
FontFamily=Trebuchet MS
SkinTxtColor=105,105,105
MOver=1
[styleSkinsBoxes]
StringCase=UPPER
StringStyle=Bold
FontColor=#SkinTxtColor#
SolidColor=64,64,64,250
FontFace=#FontFamily#
FontSize=24
padding=10,10,10,10
AntiAlias=1
MouseOverAction= [!SetVariable MOver "1"][!UpdateMeasure MeasureBatteryLauncher]
MouseLeaveAction=[!SetVariable MOver "0"][!UpdateMeasure MeasureBatteryLauncher]
DynamicVariables=1
[MeasureBatteryLauncher]
Measure=Plugin
Plugin=ConfigActive
ConfigName=#ROOTCONFIG#\Battery
IfConditionMode=1
IfCondition=(#CURRENTSECTION# = 1)
IfTrueAction= [!SetOption MeterBatteryLauncher LeftMouseUpAction """[!DeactivateConfig "#ROOTCONFIG#\Battery"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#ActivatedSkinColor#"][!SetVariable SkinTxtColor "#ActivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfFalseAction=[!UpdateMeasure "MeasureState"][!SetOption MeterBatteryLauncher LeftMouseUpAction """[!ActivateConfig "#ROOTCONFIG#\Battery" "Battery.ini"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#DeactivatedSkinColor#"][!UpdateMeter *][!Redraw]
UpdateDivider=-1
[MeasureState]
Measure=Calc
Formula=[MeasureBatteryLauncher:]
IfCondition=#MOver# <= 0
IfTrueAction= [!SetVariable SkinTxtColor "#DeactivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetVariable SkinTxtColor "#ActivatedSkinTxtColor#"] [!UpdateMeter *][!Redraw]
DynamicVariables=1
UpdateDivider=-1
[MeterBatteryLauncher]
Meter=String
MeterStyle=styleSkinsBoxes
Text=Battery
pul53dr1v3r
Posts: 442 Joined: July 30th, 2014, 10:30 am
Post
by pul53dr1v3r » August 21st, 2019, 9:00 am
Hi ikarus. Ty for your try to help! Regrettably there are 2 issues with the approach.
-1st: about the two
Update=-1 options in
[MeasureState] and
[MeasureBatteryLauncher] measures where the colors won't change according to skin state if the skin's being loaded/unloaded apart from the button (either manually from the context menu or using another copy of this button).
-2nd: when the
[MeasureBatteryLauncher] is not 1 (button state is off), the button's text color gets red after Rainmeter refresh, or if the button is refreshed not movin mouse over it.
ikarus1969
Posts: 571 Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria
Post
by ikarus1969 » August 21st, 2019, 9:18 am
Pul53dr1v3r wrote: ↑ August 21st, 2019, 9:00 am
Hi ikarus. Ty for your try to help! Regrettably there are 2 issues with the approach.
So i have to apologize
- i just covered a very specific case of the problem without digging deep enough into your problem...
pul53dr1v3r
Posts: 442 Joined: July 30th, 2014, 10:30 am
Post
by pul53dr1v3r » August 21st, 2019, 5:09 pm
ikarus1969 wrote: ↑ August 21st, 2019, 9:18 am
So i have to apologize
- i just covered a very specific case of the problem without digging deep enough into your problem...
ah, no need for the apology because of a real try to help. Thank you for it.
Hope there is a proper solution for this in somebody's "archive"...
eclectic-tech
Rainmeter Sage
Posts: 5406 Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Post
by eclectic-tech » August 22nd, 2019, 12:42 am
Pul53dr1v3r wrote: Ok, i applied it to my example and it does the job but it's not so fast at all because of using ConfigActive plug-in in the calculation,
The delay in the color change is being caused by evaluating the active config in [MeasureBatteryLauncher] then using another measure [MeasureState] to evaluate [MeasureBatteryLauncher] again.
Rather than a second separate measure to test the "state", add those condition tests to [MeasureBatteryLauncher] and remove [MeasureState].
This should eliminate the delay in color changes.
Code: Select all
[MeasureBatteryLauncher]
Measure=Plugin
Plugin=ConfigActive
ConfigName=#ROOTCONFIG#\Battery
IfCondition=(#CURRENTSECTION# = 1)
IfTrueAction=[!SetOption MeterBatteryLauncher LeftMouseUpAction """[!DeactivateConfig "#ROOTCONFIG#\Battery"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#ActivatedSkinColor#"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterBatteryLauncher LeftMouseUpAction """[!ActivateConfig "#ROOTCONFIG#\Battery" "Battery.ini"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#DeactivatedSkinColor#"][!UpdateMeter *][!Redraw]
IfCondition2=(#CURRENTSECTION# = 1)
IfTrueAction2=[!SetVariable SkinTxtColor "#ActivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfCondition3=(#CURRENTSECTION# <= 0) && (#MOver# <= 0)
IfTrueAction3=[!SetVariable SkinTxtColor "#DeactivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfCondition4=(#CURRENTSECTION# <= 0) && (#MOver# = 1)
IfTrueAction4=[!SetVariable SkinTxtColor "#ActivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
DynamicVariables=1
pul53dr1v3r
Posts: 442 Joined: July 30th, 2014, 10:30 am
Post
by pul53dr1v3r » August 22nd, 2019, 10:55 am
eclectic-tech wrote: ↑ August 22nd, 2019, 12:42 am
The delay in the color change is being caused by evaluating the active config in [MeasureBatteryLauncher] then using another measure [MeasureState] to evaluate [MeasureBatteryLauncher] again.
Rather than a second separate measure to test the "state", add those condition tests to [MeasureBatteryLauncher] and remove [MeasureState].
This should eliminate the delay in color changes.
Code: Select all
[MeasureBatteryLauncher]
Measure=Plugin
Plugin=ConfigActive
ConfigName=#ROOTCONFIG#\Battery
IfCondition=(#CURRENTSECTION# = 1)
IfTrueAction=[!SetOption MeterBatteryLauncher LeftMouseUpAction """[!DeactivateConfig "#ROOTCONFIG#\Battery"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#ActivatedSkinColor#"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterBatteryLauncher LeftMouseUpAction """[!ActivateConfig "#ROOTCONFIG#\Battery" "Battery.ini"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#DeactivatedSkinColor#"][!UpdateMeter *][!Redraw]
IfCondition2=(#CURRENTSECTION# = 1)
IfTrueAction2=[!SetVariable SkinTxtColor "#ActivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfCondition3=(#CURRENTSECTION# <= 0) && (#MOver# <= 0)
IfTrueAction3=[!SetVariable SkinTxtColor "#DeactivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfCondition4=(#CURRENTSECTION# <= 0) && (#MOver# = 1)
IfTrueAction4=[!SetVariable SkinTxtColor "#ActivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
DynamicVariables=1
Good job ET. Ty. I forgot to mention that the
issue 2 persists from the beginning, not only in the ikarus' approach.
But in the meanwhile i figured out how to solve it:
Code: Select all
[MeasureBatteryLauncher]
Measure=Plugin
Plugin=ConfigActive
ConfigName=#ROOTCONFIG#\Battery
IfCondition=(#CURRENTSECTION# = 1)
IfTrueAction=[!SetOption MeterBatteryLauncher LeftMouseUpAction """[!DeactivateConfig "#ROOTCONFIG#\Battery"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#ActivatedSkinColor#"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterBatteryLauncher LeftMouseUpAction """[!ActivateConfig "#ROOTCONFIG#\Battery" "Battery.ini"]"""][!SetOption "MeterBatteryLauncher" "SolidColor" "#DeactivatedSkinColor#"][!UpdateMeter *][!Redraw]
IfCondition2=(#CURRENTSECTION# <= 0) && (#MOver# <= 0)
IfTrueAction2=[!SetVariable SkinTxtColor "#DeactivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfCondition3=(#CURRENTSECTION# <= 0) && (#MOver# = 1)
IfTrueAction3=[!SetVariable SkinTxtColor "#ActivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfCondition4=(#CURRENTSECTION# = 1)
IfTrueAction4=[!SetVariable SkinTxtColor "#ActivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
IfCondition5=(#CURRENTSECTION# <= 0)
IfTrueAction5=[!SetVariable SkinTxtColor "#DeactivatedSkinTxtColor#"][!UpdateMeter *][!Redraw]
DynamicVariables=1
but that approach brought up a small issue where, after Rainmeter refresh, the button won't react on first
MouseOverAction but just after the second one.
eclectic-tech
Rainmeter Sage
Posts: 5406 Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Post
by eclectic-tech » August 22nd, 2019, 11:36 am
Set the initial value of MOver to zero in your [Variables] section.