It is currently April 28th, 2024, 8:12 am

Relative Position after RainmeterHideMeter

General topics related to Rainmeter.
Cheezzhead
Posts: 3
Joined: May 15th, 2011, 6:03 pm

Relative Position after RainmeterHideMeter

Post by Cheezzhead »

I'm new to the rainmeter skin-developing, and I'm having trouble using the relative position of a meter.

My problem is this: I use a if-condition to hide one ore more meters that are displayed next to each other. The meter directly below those (where Y=0R) is supposed to, well, display directly below them (obviously). But when the skin hides the last of those meters stacked next to each other, the relative position will fail and instead be displayed on the same level as the originals.

Might be a bit confusing, so here's an example: I have 3 meters A, B, and C, which are supposed to be stacked next to each other. I have 1 meter below it, let's call it D, that has a Y=0R, so it will display directly below the last meter (in this case, C):

A B C
D

Now, when my if-condition hides C, the relative position is messed up and D will instead be displayed at the same place as A.

My assumption was that if C would be hidden, the relative position would instead be linked to B, but that doesn't seem to be the case. Is there any easy way around this? I would like to retain the relative position if possible.

If this is too confusing, I can upload my skin.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Relative Position after RainmeterHideMeter

Post by jsmorley »

Putting a Y=0R on a meter has nothing at all do so with where it is positioned in the X=axis though. it only means, put this "under" the last meter, relative to the bottom of it. Your problem is probably not with the Y=0R, but with whatever you are doing to make the X-axis relative as well.

The way Rainmeter works, when you use "R" to do relative positioning, (position relative to the end of previous meter) and you hide the parent meter, the relative position becomes in effect at the end of the last "unhidden" meter. Well actually, it is STILL at the end of the previous one, as the hidden meter is really still there, and the next meter is still relative to it, but the hidden meter now has a width and height of "0". If you however use "r" to do relative positioning (position relative to the beginning of the previous meter) and then hide the parent, the child meter will remain where it is, as the parent meter, even at a width/height of "0", still has a beginning point.

This is the advantage of "r" over "R" in some cases, although it in effect means you need to know the width or height of the parent ahead of time.

This code might help demonstrate. Click on the gold and green meters to show how hidden changes things with "R" and "r", and the red one to restore things.

Code: Select all

[Rainmeter]
Update=500
DynamicWindowSize=1

[RedMeter]
Meter=Image
SolidColor=209,42,70
W=50
H=50
X=0
Y=0
LeftMouseUpAction=!Execute [!RainmeterShowMeter BlueMeter][!RainmeterShowMeter GreenMeter]

[BlueMeter]
Meter=Image
SolidColor=42,70,209
W=50
H=50
X=R
Y=0
LeftMouseUpAction=!Execute [!RainmeterShowMeter GreenMeter]

[GreenMeter]
Meter=Image
SolidColor=42,209,53
W=50
H=50
X=R
Y=0
LeftMouseUpAction=!RainmeterHideMeter BlueMeter

[GoldMeter]
Meter=Image
SolidColor=209,184,42
W=50
H=50
X=r
Y=R
LeftMouseUpAction=!RainmeterHideMeter GreenMeter
01.png
If I am missing something, please do post your skin so I can see it in action.
You do not have the required permissions to view the files attached to this post.
Cheezzhead
Posts: 3
Joined: May 15th, 2011, 6:03 pm

Re: Relative Position after RainmeterHideMeter

Post by Cheezzhead »

Ah, I already suspected something in the likes of that. At least now I know where/what's the reason, so thanks. Since I would like my skin to be able to work if users prefer other fonts/sizes/styles, I was hoping relative position would talke care of all that. Oh well, guess that's out the window then. (Unless I can use the fontsize?)

Thanks for your quick response.