It is currently March 29th, 2024, 6:22 am

Thread for help with the Shape meter

Get help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the new Shape meter

Post by sl23 »

I was thinking something like this, but it doesn't work:
[sHighlight2]
MouseOverAction=[!SetVariable #CURRENTSECTION# sw "2"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetVariable #CURRENTSECTION# sw ""] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
[Icon3]
Meter=Shape
MeterStyle=sHighlight2
Shape=Rectangle 0,0,24,24,50 | Extend MyModifiers1
MyModifiers1=Fill Color 128,128,128 | StrokeWidth #sw# | Stroke Color 128,255,0
MouseOverAction=[!ShowMeter "Name3"] [!UpdateMeter *] [!Redraw]
MouseLeaveAction=[!HideMeter "Name3"] [!UpdateMeter *] [!Redraw]
LeftMouseUpAction=["D:\Documents\- TEST -\NTD2.txt"]
DynamicVariables=1
X=-4
Y=30r

[Name3]
Meter=STRING
MeterStyle=sName
Text=3
X=10R
Y=r
Note the [sHighlight] section.
- MuLab -
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Variables]

[StrokeStyle]
justMyStroke=Stroke Color 67,67,67,255

[MeterShape1]
Meter=Shape
Shape=Rectangle 4,4,300,150 | StrokeWidth 8 | Extend justMyStroke
MeterStyle=StrokeStyle
DynamicVariables=1
MouseOverAction=[!SetOption #CURRENTSECTION# justMyStroke "Stroke Color 67,67,67,0"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# justMyStroke ""][!UpdateMeter *][!Redraw]

[MeterShape2]
Meter=Shape
Shape=Rectangle 4,4,300,150 | StrokeWidth 8 | Extend justMyStroke
MeterStyle=StrokeStyle
Y=10R
DynamicVariables=1
MouseOverAction=[!SetOption #CURRENTSECTION# justMyStroke "Stroke Color 67,67,67,0"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# justMyStroke ""][!UpdateMeter *][!Redraw]

GIF.gif
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the new Shape meter

Post by Yincognito »

sl23 wrote: August 8th, 2019, 12:33 am I was thinking something like this, but it doesn't work:

Code: Select all

[sHighlight2]
MouseOverAction=[!SetVariable #CURRENTSECTION# sw "2"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetVariable #CURRENTSECTION# sw ""] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
...
Jsmorley already provided a solution to your problem, but just so you know, you had an (unintentional?) mistake in the code above: it should have been [!SetVariable sw "2"] instead of [!SetVariable #CURRENTSECTION# sw "2"]. The latter form is used for the !SetOption bangs, not for the !SetVariable ones.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the new Shape meter

Post by sl23 »

Amazing! You guys are amazing! Thank you both for supplying code and solving my issue.

I haven't tried it yet, but can't wait lol

I thought you had to use the Set Variable bang to use variables! So thanks for explaining :)
- MuLab -
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Thread for help with the new Shape meter

Post by balala »

sl23 wrote: August 8th, 2019, 12:16 am Is it possible to use a similar instruction for the StrokeWidth?
Yep, it definitely is. For instance starting from jsmorley's above code, you have to add extenders for the Shape meters, then modify those ones:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Variables]
StrokeAlpha=255
StrokeWidth=8

[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# MyModifiers2 "Stroke Color 47,47,47,0"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# MyModifiers2 "Stroke Color 47,47,47,255"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]

[MeterShape1]
Meter=Shape
MeterStyle=sHighlight
Shape=Rectangle 4,4,300,150 | Extend MyModifiers1, MyModifiers2
MyModifiers1=StrokeWidth #StrokeWidth#
MyModifiers2=Stroke Color 47,47,47,255

[MeterShape2]
Meter=Shape
MeterStyle=sHighlight
Y=10R
Shape=Rectangle 4,4,300,150 | Extend MyModifiers1, MyModifiers2
MyModifiers1=StrokeWidth #StrokeWidth#
MyModifiers2=Stroke Color 47,47,47,255
As you can see this time I modified the color of the stroke, through the MyModifiers2 option, previously added to both Shape meters.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the new Shape meter

Post by Yincognito »

sl23 wrote: August 8th, 2019, 8:28 amI thought you had to use the Set Variable bang to use variables! So thanks for explaining :)
To make things clear: in general, the !SetVariable bang is indeed used to modify the value of variables, just like the !SetOption bang is used to modify options. So, from this point of view, you weren't mistaken - it was just a matter of confusing the former's syntax with the latter's in your original code.

In practice, you can use either of these two methods (or even a mixture of them) to do your thing - for example, jsmorley and balala used !SetOption bangs to make it happen, but you can easily use !SetVariable bangs if you like (the code below is based on balala's reply):

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Variables]
StrokeAlpha=255
StrokeWidth=8

[sHighlight]
MouseOverAction=[!SetVariable StrokeAlpha 0][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetVariable StrokeAlpha 255][!UpdateMeter "#CURRENTSECTION#"][!Redraw]

[MeterShape1]
Meter=Shape
MeterStyle=sHighlight
Shape=Rectangle 4,4,300,150 | Extend MyModifiers1, MyModifiers2
MyModifiers1=StrokeWidth #StrokeWidth#
MyModifiers2=Stroke Color 47,47,47,#StrokeAlpha#
DynamicVariables=1
UpdateDivider=-1

[MeterShape2]
Meter=Shape
MeterStyle=sHighlight
Y=10R
Shape=Rectangle 4,4,300,150 | Extend MyModifiers1, MyModifiers2
MyModifiers1=StrokeWidth #StrokeWidth#
MyModifiers2=Stroke Color 47,47,47,#StrokeAlpha#
DynamicVariables=1
UpdateDivider=-1
Obviously, dynamic variables are required, and setting the update divider to -1 in order to update the relevant meters only when needed is a good idea.

Whether you prefer one method over the other, that's entirely up to you. I just wanted to point out that you can do it using !SetVariable bangs as well, in case you had the wrong impression on this...

EDIT: You can control the stroke width as well, by replacing, say, [!SetVariable StrokeAlpha 0] with [!SetVariable StrokeWidth 8] and [!SetVariable StrokeAlpha 255] with [!SetVariable StrokeWidth 1] in the above code (it makes more sense to me to make the highlighted/hovered frame thicker, instead of the opposite, by the way).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the new Shape meter

Post by sl23 »

Thanks for the demo code. I think I get it.

I've managed to transmogrify the code supplied by jsmorley. I tried the others but didn't work. must be something I did or something in my code?

Anyway, It works ok so far, but I've hit another snag that introduces a variable(?) from other sections.
Basically I have the skin set to show the stroke on hover using a central common Style. But I want the name of the specific app to show when I hover over it's icon launcher button.

The problem is, because I've used Mouse Actions in a Style, they seem to be ignored in the BG# Section. To understand, it's easier to see the code:

Code: Select all

====================================================
; STYLES
====================================================

[sName]
FontFace=Corbel
StringStyle=Bold
FontSize=12
FontColor=175,175,175
AntiAlias=1
Hidden=1
X=10R
Y=1r

[sStroke]
MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 67,67,67,255"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha ""][!UpdateMeter *][!Redraw]
Shape=Rectangle 0,0,24,24,50 | Fill Color 128,128,128 | StrokeWidth 4 | Extend StrokeAlpha
StrokeAlpha=Stroke Color 67,67,67,0
X=-4
Y=30r

========================================
; APP 1
========================================

[BG1]
Meter=Shape
MeterStyle=sStroke
DynamicVariables=1
;MouseOverAction=[!ShowMeter "Name1"] [!UpdateMeter *] [!Redraw]
;MouseLeaveAction=[!HideMeter "Name1"] [!UpdateMeter *] [!Redraw]
LeftMouseUpAction=["D:\Documents\- TEST -\NTD1.txt"]

[Name1]
Meter=STRING
MeterStyle=sName
Text=Waterfox
X=10R

========================================
; APP 2
========================================

[BG2]
Meter=Shape
MeterStyle=sStroke
DynamicVariables=1

[Name2]
Meter=STRING
MeterStyle=sName
Text=Thunderbird

========================================
; APP 3
========================================

[BG3]
Meter=Shape
MeterStyle=sStroke
DynamicVariables=1

[Name3]
Meter=STRING
MeterStyle=sName
Text=MuLab
If I enable Mouse Actions in BG1 it shows the Name1 but disables the highlighting of the Stroke Alpha.
I know I need to add these actions into the [sStroke] Section, but again, I'm stumped on how to even begin to add actions for something whose Section and Text changes! Because for the Alpha, I used #CURRENTSECTION#, but you can't use that as it changes dependent on the highlighted button.

Actually, I'll see if I can figure out how to use another [STYLE] section to get it going. Then I'll come back when I fail! :D

EDIT: My apologies I forgot I'm posting in the Shape thread. Should I create a new thread to avoid clogging this up? MOD's: Please move this post if you feel you need to
- MuLab -
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Thread for help with the new Shape meter

Post by balala »

Yincognito wrote: August 8th, 2019, 10:28 am Obviously, dynamic variables are required, and setting the update divider to -1 in order to update the relevant meters only when needed is a good idea.
No, it's not a good idea, it is absolutely needed! If you don1t set the UpdateDivider of both meters to -1, both will get receive the newly set transparency of the stroke. Using the !Setoption method, this can be avoided.
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the new Shape meter

Post by sl23 »

I set Rainmeter to not update as this is just a launcher skin, is that ok? It seems to work so far, apart from adding the text.

What exactly does DynamicVariable do? Is it only required if using [Variables]?
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the new Shape meter

Post by Yincognito »

balala wrote: August 8th, 2019, 11:42 am No, it's not a good idea, it is absolutely needed! If you don1t set the UpdateDivider of both meters to -1, both will get receive the newly set transparency of the stroke. Using the !Setoption method, this can be avoided.
I know - that's why I included them. :D Using "a good idea" instead of "absolutely needed" was just another way of saying it. I hate to always use the same words, so I was probably trying to be 'creative', LOL.

Other than that, there is no reason to avoid setting the update divider to -1 on the meters, as long as it doesn't interfere with other processes in the skin - after all, the 'highlight' is triggered on demand (i.e. on hover) anyway. Since the example was pretty basic, I didn't think it was a problem, but then, it always depends on what else you have in your skin.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth