It is currently March 28th, 2024, 3:55 pm

AnchorX/AnchorY Not working at all

Report bugs with the Rainmeter application and suggest features.
Ashtefere
Posts: 7
Joined: December 13th, 2017, 9:42 am

AnchorX/AnchorY Not working at all

Post by Ashtefere »

As stated.

Tested on latest beta with latest windows. Rainmeter skin doesn't change its behaviour at all with any AnchorX/AnchorY setting, as if it is ignored.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: AnchorX/AnchorY Not working at all

Post by jsmorley »

Need to know what you are trying to accomplish. AnchorX and AnchorY certainly work, but are used in conjunction with WindowX and WindowY.
Ashtefere
Posts: 7
Joined: December 13th, 2017, 9:42 am

Re: AnchorX/AnchorY Not working at all

Post by Ashtefere »

I just checked again.

What doesnt work:

Rainmeter.ini

Code: Select all

AnchorX=50%
AnchorY=50%
Skin Bang

Code: Select all

[!Move "#WORKAREAWIDTH#/2" "#WORKAREAHEIGHT#/2" targetSkin]
or

Code: Select all

[!Move "50%" "50%" targetSkin]
This results in:

Image

What does work:

Code: Select all

AnchorX=50%
AnchorY=50%
WindowX=50%
WindowY=50%
This results in:

Image

I would assume that the !Move bang will move the skin by it's anchor. Is this not the intended behavior?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: AnchorX/AnchorY Not working at all

Post by jsmorley »

Let us dig into this... It's possible that !Move does not take AnchorX/AnchorY into consideration.

In the meantime, I'd be tempted to do something like:

Code: Select all

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

[MeasureMove]
Measure=Calc
UpdateDivider=-1
OnUpdateAction=[!Move "((#SCREENAREAWIDTH#/2)-(#CURRENTCONFIGWIDTH#/2))" "((#SCREENAREAHEIGHT#/2)-(#CURRENTCONFIGHEIGHT#/2))"]
DynamicVariables=1

[MeterImage]
Meter=Image
W=100
H=100
SolidColor=255,0,0,255
I put the !Move in an OnUpdateAction in a measure in the skin, rather than in [Rainmeter] as an OnRefreshAction, so it will be able to know the value of #CURRENTCONFIGWIDTH# / #CURRENTCONFIGHEIGHT#, which must be used "dynamically", and [Rainmeter] can't do that.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: AnchorX/AnchorY Not working at all

Post by jsmorley »

Here is a trick that isn't commonly known...

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!Move "(([#SCREENAREAWIDTH]/2)-([#CURRENTCONFIGWIDTH]/2))" "(([#SCREENAREAHEIGHT]/2)-([#CURRENTCONFIGHEIGHT]/2))"]

[MeterImage]
Meter=Image
W=100
H=100
SolidColor=255,0,0,255
Note that in this case I HAVE put the action into an OnRefreshAction in the [Rainmeter] section. Why does this work, when I stated above that #CURRENTCONFIGWIDTH# / #CURRENTCONFIGHEIGHT# can't be "dynamic" in the [Rainmeter] section?

https://docs.rainmeter.net/manual/variables/nesting-variables/

It's because all [#NestedVariables] are always dynamically resolved when they are used in a bang, and so are always used in a "dynamic" way, even in the [Rainmeter] section of the skin. Regular #Variables# are not by nature dynamic, and must be used with DynamicVariables=1 in measures or meters, and can't be dynamic in [Rainmeter].
Ashtefere
Posts: 7
Joined: December 13th, 2017, 9:42 am

Re: AnchorX/AnchorY Not working at all

Post by Ashtefere »

I would do this, but unfortunately that is now how the skin needs to work.

I have the top bar skin with an button (meter), that when hovered with the mouse should do this:

Image

The skin should center it's X position on the hovered meter.

This works fine on any skins that have a fixed with (I just do some math) but for dynamic width skins there is not a solution.

!Move taking AnchorX into consideration would solve this (and seems like this should be the actual behaviour) but without that, I would need to do a bunch of !Setvariable, !UpdateMeasure, !OnUpdate stuff to get that to work, which is not ideal.

Is there any chance of getting the !move bang to recognize the AnchorX/Y setting? And while I'm begging for things, a !SetAnchorX/Y bang would also be great.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: AnchorX/AnchorY Not working at all

Post by jsmorley »

Ashtefere
Posts: 7
Joined: December 13th, 2017, 9:42 am

Re: AnchorX/AnchorY Not working at all

Post by Ashtefere »

Won't work in my instance, as the X position I need is dynamic at any time, and the width of the meter is dynamic at any time. I will use the !SetVariable/!UpdateMeasure/!OnUpdate trick in the mean time.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: AnchorX/AnchorY Not working at all

Post by jsmorley »

Ashtefere wrote:Won't work in my instance, as the X position I need is dynamic at any time, and the width of the meter is dynamic at any time. I will use the !SetVariable/!UpdateMeasure/!OnUpdate trick in the mean time.
Gotcha.. Ok, well we will look into this.
User avatar
Virginityrocks
Posts: 478
Joined: February 26th, 2011, 10:22 pm

Re: AnchorX/AnchorY Not working at all

Post by Virginityrocks »

I like the skin you're working on. What's its name?
Post Reply