It is currently April 18th, 2024, 10:01 pm

"R" spacing

Get help with creating, editing & fixing problems with skins
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

"R" spacing

Post by kyriakos876 »

I hope y'all don't hate my by now for posting all these things...
So, I read here that
X,Y;;Default: 0;;X=10R : Meter begins 10 horizontal pixels to the right of the previous meter.
Well, what if it's a string that has

Code: Select all

StringAlign=Center
Does that still mean it begins 10 horizontal pixels to the right of the previous meter?
Because here's what I get:
Example.png
The distance between the green box and the end of the string is increased, while the code is

Code: Select all

[NormalCenter]
StringAlign=Center
FontColor=200,200,200
FontFace=Roboto
FontSize=13
AntiAlias=1

[Shortcut5]
Meter=String
MeterStyle=NormalCenter
Text="Youtube"
X=R
Y=15
Padding=0,3,0,0
MouseOverAction=[!SomeAction]
MouseLeaveAction=[!SomeAction]
LeftMouseUpAction=[!SomeAction]
DynamicVariables=1
UpdateDivider=-1

[GreenBox]
Meter=Image
X=R
SolidColor=0,255,0
W=10
H=10
Y=10
In both cases... The only thing I change is the Text option from "Youtube" to "Youtubeeeeeeeee"

According to the docs, the green box should be drawn right after the string, yet it isn't.
Is somehow the width of the string connected to this? Because that's what I think, but I don't understand how...
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: "R" spacing

Post by balala »

When a String meter is aligned to center and the next meter is positioned using the R parameter, its position is calculated like the String meter would be aligned left. If you try to modify the StringAlign option of the [NormalCenter] meter to StringAlign=Left, you'll see what am I talking about. Not sure what is the explanation, but this is the fact.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: "R" spacing

Post by Active Colors »

kyriakos876 wrote: October 20th, 2018, 2:54 pm I hope y'all don't hate my by now for posting all these things...
So, I read here that
X,Y;;Default: 0;;X=10R : Meter begins 10 horizontal pixels to the right of the previous meter.
Well, what if it's a string that has

Code: Select all

StringAlign=Center
Does that still mean it begins 10 horizontal pixels to the right of the previous meter?
Because here's what I get:
Example.png
The distance between the green box and the end of the string is increased, while the code is

Code: Select all

[NormalCenter]
StringAlign=Center
FontColor=200,200,200
FontFace=Roboto
FontSize=13
AntiAlias=1

[Shortcut5]
Meter=String
MeterStyle=NormalCenter
Text="Youtube"
X=R
Y=15
Padding=0,3,0,0
MouseOverAction=[!SomeAction]
MouseLeaveAction=[!SomeAction]
LeftMouseUpAction=[!SomeAction]
DynamicVariables=1
UpdateDivider=-1

[GreenBox]
Meter=Image
X=R
SolidColor=0,255,0
W=10
H=10
Y=10
In both cases... The only thing I change is the Text option from "Youtube" to "Youtubeeeeeeeee"

According to the docs, the green box should be drawn right after the string, yet it isn't.
Is somehow the width of the string connected to this? Because that's what I think, but I don't understand how...
It's a bit tricky question. Relative positioning r and R disregard how string meter is aligned and treats it as any meter that is drawn by default from the top left pixel. Because relative positioning looks for X and W of the relative meter. When you align your text by Center or by Right your X and W stay the same.
To actually position it you should use section variables.

Code: Select all

[GreenBox]
Meter=Image
X=([Shortcut5:X]+[Shortcut5:W])
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: "R" spacing

Post by jsmorley »

The "R" modifier on X is always related to the meter container, not the contents of the meter.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: "R" spacing

Post by kyriakos876 »

balala wrote: October 20th, 2018, 3:23 pm When a String meter is aligned to center and the next meter is positioned using the R parameter, its position is calculated like the String meter would be aligned left. If you try to modify the StringAlign option of the [NormalCenter] meter to StringAlign=Left, you'll see what am I talking about. Not sure what is the explanation, but this is the fact.
Yea I'm aware that with StringAlign=Left it's normal... I just wanted to know why is that with R when to docs say it's relative to the previous meter... it's acting like I've set some padding to the right of the meter which is not the case obviously.
Active Colors wrote: October 20th, 2018, 4:35 pm

Code: Select all

[GreenBox]
Meter=Image
X=([Shortcut5:X]+[Shortcut5:W])
That's what I was using until I decided R was much simpler.
jsmorley wrote: October 20th, 2018, 4:38 pm The "R" modifier on X is always related to the meter container, not the contents of the meter.
Shouldn't the meter's container end where the content of that meter ends?
I realized that only if I force a container by doing W=200 it works and the R of the next meter starts where the actual content of the meter ends, but this is very annoying because you have to manually find the W of the actual content, and you can't use [Shortcut5:W] obviously because it thinks it's larger than it actually is as seen in the pictures of the first post.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: "R" spacing

Post by jsmorley »

That is some strange behavior. Not quite sure what is being added to what it detects as "R" in that case.

Anyway, I would fix it with:

Code: Select all

[NormalCenter]
StringAlign=Center
FontColor=200,200,200
SolidColor=255,0,0,90
FontFace=Roboto
FontSize=13
AntiAlias=1

[Shortcut5]
Meter=String
MeterStyle=NormalCenter
Text="YouTubeeeeeeeeeeeeeee"
X=100
Y=15
Padding=0,3,0,0
MouseOverAction=[!SomeAction]
MouseLeaveAction=[!SomeAction]
LeftMouseUpAction=[!SomeAction]
DynamicVariables=1
UpdateDivider=-1

[GreenBox]
Meter=Image
X=(([ShortCut5:X]+[ShortCut5:W])+10)
SolidColor=0,255,0
W=10
H=10
Y=10
DynamicVariables=1
That will have [GreenBox] set 10px to the right of [Shortcut5], no matter how long the string is.

You didn't set a W on the String meter, and that is fine, you don't need it. You DO need a valid X when you are using Center or Right though. Center and Right must have an answer to the question "Center on what?", or "Right justify on what?". It is based on a specific location. Neither of them can be zero.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: "R" spacing

Post by Active Colors »

kyriakos876 wrote: October 20th, 2018, 6:11 pm I realized that only if I force a container by doing W=200 it works and the R of the next meter starts where the actual content of the meter ends
For me it is quite opposite. If I define W of the string meter and center it, the next meter which I position relatively to the previous is shifted to right.
Capture.PNG
You do not have the required permissions to view the files attached to this post.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: "R" spacing

Post by kyriakos876 »

jsmorley wrote: October 20th, 2018, 6:18 pm That is some strange behavior. Not quite sure what is being added to what it detects as "R" in that case.

Anyway, I would fix it with:

Code: Select all

[NormalCenter]
StringAlign=Center
FontColor=200,200,200
SolidColor=255,0,0,90
FontFace=Roboto
FontSize=13
AntiAlias=1

[Shortcut5]
Meter=String
MeterStyle=NormalCenter
Text="YouTubeeeeeeeeeeeeeee"
X=100
Y=15
Padding=0,3,0,0
MouseOverAction=[!SomeAction]
MouseLeaveAction=[!SomeAction]
LeftMouseUpAction=[!SomeAction]
DynamicVariables=1
UpdateDivider=-1

[GreenBox]
Meter=Image
X=(([ShortCut5:X]+[ShortCut5:W])+10)
SolidColor=0,255,0
W=10
H=10
Y=10
DynamicVariables=1
That will have [GreenBox] set 10px to the right of [Shortcut5], no matter how long the string is.

You didn't set a W on the String meter, and that is fine, you don't need it. You DO need a valid X when you are using Center or Right though. Center and Right must have an answer to the question "Center on what?", or "Right justify on what?". It is based on a specific location. Neither of them can be zero.
Yea this works, I just didn't like the idea of having to write / modify this X=(([ShortCut5:X]+[ShortCut5:W])+10) for every shortcut (The skin is a launcher)
Active Colors wrote: October 20th, 2018, 6:24 pm For me it is quite opposite. If I define W of the string meter and center it, the next meter which I position relatively to the previous is shifted to right.

Capture.PNG
That's because the ACTUAL width of the "Some text" string is not 150 as I see in your picture's code, try something like 35-40-45 etc... It should do the trick. But again, You would have to specify a different W for every text. For example Some text would be W=40 and Some text with more strings would be W=100 or something like that. And if you dared to change the font size, you would have to change all of those. Messy... I'll go with the more standard X=(([ShortCut5:X]+[ShortCut5:W])+something). Not as dynamic as I wanted it to be, but it works... kinda...
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: "R" spacing

Post by Active Colors »

kyriakos876 wrote: October 20th, 2018, 11:23 pm That's because the ACTUAL width of the "Some text" string is not 150 as I see in your picture's code, try something like 35-40-45 etc... It should do the trick.
Capture.PNG
It does not for me...
kyriakos876 wrote: October 20th, 2018, 11:23 pm I'll go with the more standard X=(([ShortCut5:X]+[ShortCut5:W])+something). Not as dynamic as I wanted it to be, but it works... kinda...
You can omit that with MeterStyles. What is your use case? I see you have bunch of shortcuts with pretty same formulas. Post some example.
You do not have the required permissions to view the files attached to this post.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: "R" spacing

Post by kyriakos876 »

Active Colors wrote: October 20th, 2018, 11:42 pm Capture.PNG
It does not for me...


You can omit that with MeterStyles. What is your use case? I see you have bunch of shortcuts with pretty same formulas. Post some example.
I will when I have some code that's readable to somebody other than me lol it's weird that the background of your text shrinked but not the text itself... Is the background another meter? Because then there could be more stuff messing with it