It is currently March 28th, 2024, 9:30 am

Update versus Refresh

Get help with creating, editing & fixing problems with skins
Post Reply
F!.OW
Posts: 22
Joined: April 1st, 2018, 12:42 pm

Update versus Refresh

Post by F!.OW »

Before releasing my (first) suite, I made the rookie mistake of updating my skins by defaulting to !Refresh. That habit has changed, since coming across https://forum.rainmeter.net/viewtopic.php?p=119966#p119966.

I have 2 problems that keep me from avoiding the !Refresh command. I've included a sample skin below.
Update Groups.jpg
Update Groups_1.0.rmskin
(2.26 KiB) Downloaded 26 times
First problem:
Clicking on BLUE or PINK changes the colors of the skins accordingly, via Update and Redraw. Clicking on ENGLISH or FRENCH don't produce the same results. Is it because the Variables are inside Include files? Do I have to update each variable with the new value separately or is there a way to do it as a group?
Note: You can Right-click OPTIONS to !Refresh the skins.

Second problem:
If you hover the DATE skin, it will change to black then back to BLUE when you leave. Now, if you click PINK, the other skins change, but the DATE remains blue until you hover it again. What am I missing?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Update versus Refresh

Post by eclectic-tech »

F!.OW wrote:First problem:
Clicking on BLUE or PINK changes the colors of the skins accordingly, via Update and Redraw. Clicking on ENGLISH or FRENCH don't produce the same results. Is it because the Variables are inside Include files? Do I have to update each variable with the new value separately or is there a way to do it as a group?
Note: You can Right-click OPTIONS to !Refresh the skins.
Yes, it is because you are including a language file in your settings file; the settings file will not read the new included language file until it is refreshed. To avoid this, I would suggest making a change in how you set your language variable (use nested variables) and define the various language options in the settings file rather than an included file.

Setting.inc

Code: Select all

[Variables]
ThemeCOLOR=0,120,215
Language=FR

;@Include=#@##Language#.inc
MarchEN=March
SystemEN=System
BlueEN=Blue
PinkEN=Pink

MarchFR=Mars
SystemFR=Système
BlueFR=Bleu
PinkFR=Rose

[SegoeUI]
FontFace=Segoe UI
FontSize=12
FontColor=255,255,255
AntiAlias=1
Padding=20,15,20,15
F!.OW wrote:Second problem:
If you hover the DATE skin, it will change to black then back to BLUE when you leave. Now, if you click PINK, the other skins change, but the DATE remains blue until you hover it again. What am I missing?
You need to use 'escaped' variables when using !SetOption bang.

Clock.ini

Code: Select all

[Rainmeter]
Group=gColors

[Variables]
@Include=#@#Settings.inc

[Clock-Date]
Group=Colors
Meter=String
Text=0800 | [#March[#Language]] 28
MeterStyle=SegoeUI
StringCase=Upper
SolidColor=#ThemeCOLOR#
DynamicVariables=1
MouseOverAction=[!SetOption Clock-Date SolidColor 0,0,0,220][!UpdateMeter Clock-Date][!Redraw]
MouseLeaveAction=[!SetOption Clock-Date SolidColor #*ThemeCOLOR*#][!UpdateMeter Clock-Date][!ReDraw]
You will notice a few other changes:
Use escaped variable in the mouseleaveaction; so the new value will literally be '#ThemeCOLOR#' and not the current RGB value of #ThemeCOLOR#
After setting the new option, update the meter and redraw.
Use nested variable for the month language

-=-
Finally, your Option.ini skin also had a few typos:
Missing an opening bracket on all of the !RedrawGroup bangs
You use !UpdateMeterGroup (updates meters, not skin groups). You should use !UpdateGroup when updating separate skins
I use nested variables for the color labels

Options.ini

Code: Select all

[Rainmeter]
Group=gColors

[Variables]
@Include=#@#Settings.inc

[OptionsLabel]
Group=Colors
Meter=String
Text=OPTIONS
MeterStyle=SegoeUI
SolidColor=#ThemeCOLOR#
RightMouseUpAction=[!RefreshGroup gColors]
DynamicVariables=1

[Blue]
Meter=String
Text=[#Blue[#Language]]
MeterStyle=SegoeUI
SolidColor=0,0,0,60
Y=6R
LeftMouseUpAction=[!SetVariableGroup ThemeCOLOR "0,120,215" gColors][!WriteKeyValue Variables ThemeCOLOR 0,120,215 "#@#Settings.inc"][!UpdateGroup gColors][!RedrawGroup gColors]
DynamicVariables=1

[Pink]
Meter=String
Text=[#Pink[#Language]]
MeterStyle=SegoeUI
SolidColor=0,0,0,60
Y=6R
LeftMouseUpAction=[!SetVariableGroup ThemeCOLOR "215,0,120" gColors][!WriteKeyValue Variables ThemeCOLOR 215,0,120 "#@#Settings.inc"][!UpdateGroup gColors][!RedrawGroup gColors]
DynamicVariables=1

[English]
Meter=String
Text=English
MeterStyle=SegoeUI
SolidColor=0,0,0,60
Y=6R
LeftMouseUpAction=[!SetVariableGroup Language "EN" gColors][!WriteKeyValue Variables Language EN "#@#Settings.inc"][!UpdateGroup gColors][!RedrawGroup gColors]

[French]
Meter=String
Text=French
MeterStyle=SegoeUI
SolidColor=0,0,0,60
Y=6R
LeftMouseUpAction=[!SetVariableGroup Language "FR" gColors][!WriteKeyValue Variables Language FR "#@#Settings.inc"][!UpdateGroup gColors][!RedrawGroup gColors]
EDIT: You will need to change the Drive.ini so the correct language is shown by modifying the Text= line to: Text=[#System[#Language]] (C:)

Feel free to ask about my suggested changes... :welcome:
F!.OW
Posts: 22
Joined: April 1st, 2018, 12:42 pm

Re: Update versus Refresh

Post by F!.OW »

eclectic-tech wrote: You will notice a few other changes:
Use escaped variable in the mouseleaveaction; so the new value will literally be '#ThemeCOLOR#' and not the current RGB value of #ThemeCOLOR#
After setting the new option, update the meter and redraw.
Use nested variable for the month language
Got it. I've used an escaped variable elsewhere in my main skin (project), but I never thought to apply it in this scenario.
eclectic-tech wrote: Finally, your Option.ini skin also had a few typos:
Missing an opening bracket on all of the !RedrawGroup bangs
You use !UpdateMeterGroup (updates meters, not skin groups). You should use !UpdateGroup when updating separate skins
I use nested variables for the color labels
Yeah, thanks for catching those. I wrote this package in haste. In my project, I've shortened the Bang commands using variables. Probably not recommended, but it helps my thought process and easier to remember.
eclectic-tech wrote: EDIT: You will need to change the Drive.ini so the correct language is shown by modifying the Text= line to: Text=[#System[#Language]] (C:)
I will need to analyze this solution more, but I will definitely come back and ask, if I need to. Many thanks! :D
Post Reply