Let's say one is placing some text in a title bar, using string measures. Start with the first string being left justified and placed 12 pixels to the right of the title bar's left edge; and the second string being left justified and placed relatively 70 pixels to the right of the end of the first string X=70R. So far, everything is good. If the first string is moved left or right, the second string adjusts accordingly. Likewise if the length of the first string is modified.
Now a third string, which is right justified, is placed 12 pixels to the left of the right edge of the title bar X=(#titlebarRightEdge#-12). So the string ends 12 pixels before the end of the title bar. Adjust the string length, and its beginning position adjusts automatically so that it always ends at that same 12 pixel mark. Good.
Now, place another right justified string, relatively 70 pixels to the left of the beginning of the previous string X=-70r. Is this allowed, i.e. is a negative relative offset allowed? The idea is that this last string will always end 70 pixels to the left of the beginning of the previous string, even when the length of either or both strings is changed. But this doesn't seem to work.
It is currently April 23rd, 2024, 10:32 am
Question re relative positioning a string meter
-
- Posts: 182
- Joined: April 10th, 2014, 12:31 am
- Location: Canada
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Question re relative positioning a string meter
The issue is that StringAlign=Right uses the value of X to determine where to "end" the string, then the X value is dynamically changed to be the original value of X minus the length of the string. So the new value of X is actually the start of the string.
In a sense, what StringAlign=Right does is create the string, measures it, then it dynamically changes the X value you set to the new starting point, then draws the string as if it were left-justified. It's a function of the fact that X must always actually be the "start", and you can't literally draw a string "backwards".
The the second meter, that you want to also be right justified, and ending to the left of the first string, does the same thing with it's X value, but appears to me to be completely befuddled by the "r" on it. I'm not sure it is properly using the "new" X of the first meter in that case. I'm not sure "r" is "dynamic" enough to handle this.
I think the only answer, or at least the only reasonably simple answer, is to NOT use "r" or "R" in these cases.
Just be very sure that the X set on the first meter in the skin, [MeterOne] in my example, is large enough to hold any potential string it might have, and also enough to hold everything else as you are "backing up" strings and the space between them further and further to the left. A skin cannot "expand" to the left or up, only to the right and down.
In a sense, what StringAlign=Right does is create the string, measures it, then it dynamically changes the X value you set to the new starting point, then draws the string as if it were left-justified. It's a function of the fact that X must always actually be the "start", and you can't literally draw a string "backwards".
The the second meter, that you want to also be right justified, and ending to the left of the first string, does the same thing with it's X value, but appears to me to be completely befuddled by the "r" on it. I'm not sure it is properly using the "new" X of the first meter in that case. I'm not sure "r" is "dynamic" enough to handle this.
I think the only answer, or at least the only reasonably simple answer, is to NOT use "r" or "R" in these cases.
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeterOne]
Meter=String
StringAlign=Right
X=400
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=MeterOne:[MeterOne:X]
[MeterTwo]
Meter=String
StringAlign=Right
X=([MeterOne:X]-10)
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=MeterTwo:[MeterTwo:X]
[MeterThree]
Meter=String
StringAlign=Right
X=([MeterTwo:X]-10)
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=MeterThree:[MeterThree:X]
Just be very sure that the X set on the first meter in the skin, [MeterOne] in my example, is large enough to hold any potential string it might have, and also enough to hold everything else as you are "backing up" strings and the space between them further and further to the left. A skin cannot "expand" to the left or up, only to the right and down.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 182
- Joined: April 10th, 2014, 12:31 am
- Location: Canada
Re: Question re relative positioning a string meter
Thanks for confirming, and, oh that is a clever workaround! I tried it in my test skin, and then in my working skin, and it works great. It's simply amazing what can be accomplished by someone who knows all the ins and outs of Rainmeter.
-
- Posts: 182
- Joined: April 10th, 2014, 12:31 am
- Location: Canada
Re: Question re relative positioning a string meter
Just FYI, the same problem occurs when trying to horizontally position a meter relative to another meter which is center aligned, as when positioning relative to a meter which is right aligned, as above. And probably due to the same issue in the underlying code.