It is currently October 9th, 2024, 6:25 pm

Thread for help with the Shape meter

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 8395
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the new Shape meter

Post by Yincognito »

sl23 wrote: October 27th, 2019, 10:02 pmCan a ShapeMeter adjust size dynamically the same way that the [Rainmeter] Background=2 does? I don't think this will work as it's not taking into account what other meters do.
Jsmorley is right - it can't be done to be fully automatic, but it can be achieved through a semi-automatic process - you just have to figure out a way to know the width and the height of the skin to make it work. I did it roughly the way jsmorley explained in my skins, but set the width and the height of the skin as a function of those (initially invisible, in my case) meter widths and heights right from the start, and then used the skin's W/H as parameters in the shape definition.
jsmorley wrote: October 27th, 2019, 10:31 pmThere is no way to ask "what is the largest X+W value in the skin?" or "what is the largest Y+H value in the skin?", and even if you could, using that in a Shape meter would just once again cause a circular reference that would run amok.
Maybe you can, if you do something like using Max(Max([WidestMeter:X]+[WidestMeter:W],[AnotherMeter:X]+[AnotherMeter:W]),[LastMeter:X]+[LastMeter:W]) (or something like it) in a Calc formula. I'm just speculating here, but wouldn't this be possible?

EDIT: If the order of evaluation/execution in Rainmeter (aka measures before meters) doesn't get in the way of it, that is (although using dynamic variables might solve it, I'm not sure if on the same skin update or the next)...
sl23 wrote: October 27th, 2019, 10:02 pmPerhaps this is more related to the new Container function?
It's just that I quite like the whole shape meter as a background. Rounded corners and show Stroke on hover stuff. Useful and subtle which I prefer. Can that be done with Containers? I'm a bit wary of Containers as it looks a bit too much for me!
Don't be afraid of containers. It's a relatively new option, but easy to work with - you just have to experiment with it.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1829
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 »

:welcome:
Last edited by sl23 on August 23rd, 2024, 10:55 am, edited 1 time in total.
57686174 77696C6C 6265 77696C6C 6265
User avatar
jsmorley
Developer
Posts: 22847
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

Post by jsmorley »

I myself use Shape meters almost exclusively for skin backgrounds, as I also like slightly rounded corners and the ability to have a "border" stroke on them.

I pretty much have not used BackgroundMode=2 since the Shape meter came out...

What I find though, is that I don't really like a skins "width" to be changing dynamically as the contents of the meters changes. That feels jumpy and odd to me. A skin can only ever "grow" to the right, it can't grow to the left, so having a dynamic width makes it clumsy to position the skin on the right-hand side of the screen. You have to depend on "Keep on screen" to "move" the skin when the size changes.

What I do is figure out what the maximum "width" is that I will need for my widest or most right-aligned meter, and statically set the Shape width to that, plus a little padding so things are never jammed up against the edge. I will almost always use ClipString / ClipStringW on String meters to ensure they "wrap" before they get to the right-hand edge, no matter what the length of the content.

With the "height" I'm more open to change, and will sometimes set the height of the Shape to be the Y+W+padding value for the bottom meter in the skin. That way the skin can grow down to accommodate those String meters that "wrap" in the skin.

This also allows you to dynamically "hide" and "show" meters while having the background height adjust as needed.

Having said that, there are practically unlimited ways you can design your skins to work and look the way you want, and if we all liked the same things, there would be a hell of a traffic jam...
User avatar
Yincognito
Rainmeter Sage
Posts: 8395
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the new Shape meter

Post by Yincognito »

jsmorley wrote: October 28th, 2019, 1:12 pmI pretty much have not used BackgroundMode=2 since the Shape meter came out...
Me, I used to use BackgroundMode=2 exclusively until I had to design adjustable bevel widths for my skins, and that involved working with shape based backgrounds. I never had any regrets over switching to the latter though, as it can be made to be flexible enough for any scenario (and the additional complexity is not exaggerate).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1829
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 »

:welcome:
Last edited by sl23 on August 23rd, 2024, 10:55 am, edited 1 time in total.
57686174 77696C6C 6265 77696C6C 6265
User avatar
jsmorley
Developer
Posts: 22847
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

Post by jsmorley »

sl23 wrote: October 28th, 2019, 4:06 pm Thanks Jeff. My intention is only to have a vertical adjustment not horizontal, so that's good news :D

Perhaps you could add the shape meter to the [Rainmeter] section and have the ability to set Rm to use a shape as a dynamic background in the same way as Background=2?

That would help immensely. Just a thought.
I don't think that would add a lot of value, as you can't base the size of the skin on the Shape, and the size of the Shape on the skin, as that is an endless loop. It would have to be some new, probably confusing thing that wouldn't do much (or anything really) more than just having a Shape meter that is sized dynamically based on the meters in your skin.
User avatar
sl23
Posts: 1829
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 »

:welcome:
Last edited by sl23 on August 23rd, 2024, 10:55 am, edited 1 time in total.
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1829
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 »

:welcome:
Last edited by sl23 on August 23rd, 2024, 10:55 am, edited 1 time in total.
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8395
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the new Shape meter

Post by Yincognito »

sl23 wrote: October 28th, 2019, 11:11 pm Wow it worked! Straight away too, thanks Jeff :thumbup:
I used this:
Shape=Rectangle 1,1,180,([Footer2:Y]+[Footer2:H]),5 | Fill Color 0,0,0,50 | StrokeWidth 2 | Extend StrokeAlpha
Of course it did - it's the correct way to do it. Just in case you sometime don't know how wide/tall or where the meters are positioned (e.g. if you don't know if the Footer2 meter is the actual footer, maybe there's a meter lower than Footer2), it looks like my proposed Max() solution works as well when you don't know any of the dimensions or positions beforehand (you do have to know how many and the name of all the meters in your skin though, in order to include them in your Max() formulas). It's jsmorley's code modified a little bit:

Code: Select all

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

[Variables]
SkinWidth=(Max(Max([Meter1:XW],[Meter2:XW]),[Meter3:XW])+2*5)
SkinHeight=(Max(Max([Meter1:YH],[Meter2:YH]),[Meter3:YH])+2*5)

[MeterBackGround]
Meter=Shape
X=0
Y=0
DynamicVariables=1
Shape=Rectangle 0,0,(#SkinWidth#),(#SkinHeight#),10 | StrokeWidth 1 | Stroke Color 255,255,255,255 | Fill Color 47,47,47,255

[Meter1]
Meter=String
X=10
Y=10
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=I don't know how wide or where I am positioned

[Meter2]
Meter=String
X=10
Y=10R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Are you sure you don't?

[Meter3]
Meter=String
X=10
Y=10R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Of course I don't, I'm just a randomly wide meter positoned in a random position in the skin
Background Shape Sample.jpg
Note: The XW and YH (basically X+W and Y+H) use the "real" X/Y/W/H values. The values for X or Y may be different than the values in the meter options if StringAlign is used on a String meter and the values for W or H may be different than the values in the meter options if Padding is used. This goes for jsmorley's code as well, so it's good to know if, say, you somehow align your text to the right (in that case, I suppose adding the plain X of each meter to the Max() formulas might work, since, as far as I recall, when you align the text to the right, X becomes the rightmost point of the meter).
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16645
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Thread for help with the new Shape meter

Post by balala »

sl23 wrote: October 28th, 2019, 11:11 pm I used this:
Shape=Rectangle 1,1,180,([Footer2:Y]+[Footer2:H]),5 | Fill Color 0,0,0,50 | StrokeWidth 2 | Extend StrokeAlpha
Just to simplify a little bit the expression (as Yincognito otherwise already posted), I definitely would rewrite the Shape=Rectangle 1,1,180,([Footer2:Y]+[Footer2:H]),5 | Fill Color 0,0,0,50 | StrokeWidth 2 | Extend StrokeAlpha option as Shape=Rectangle 1,1,180,[Footer2:YH],5 | Fill Color 0,0,0,50 | StrokeWidth 2 | Extend StrokeAlpha. It's practically the same thing, but it's shorter: https://docs.rainmeter.net/manual/variables/section-variables/#XWYH