It is currently March 28th, 2024, 9:06 pm

Weird section variable positioning behavior

Get help with creating, editing & fixing problems with skins
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Weird section variable positioning behavior

Post by Active Colors »

I have dynamic section positioning working not properly and I can't see any problem it behaves like this.
I have this image meter:

Code: Select all

[ObjSlidePlay]
Meter=Image
ImageName=#@#Core\Graphics\Slideshow\play.png
X=([ObjBackground:X]+([ObjBackground:W]/2)-([#CURRENTSECTION#:W]/2))
Y=266
W=40
H=40
UpdateDivider=1
DynamicVariables=1
It seems that the [#CURRENTSECTION#:W] part is causing the trouble. Because when instead of [#CURRENTSECTION#:W] I write the actual value 40 it works as intended.

Here are couple of recorded gifs with both states. Compare play buttons on the gifs (click on the images to animate).

When I have 40 the play button works properly.
1.gif
When I have [#CURRENTSECTION#:W] the play button behaves strangely.
2.gif
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weird section variable positioning behavior

Post by balala »

It's not weird at all! In fact it's an absolutely normal behavior, even if neither I wouldn't think to this before.
So the problem: when you click the [ObjSlidePlay] meter (I think it's a play button, right?), besides other actions, this meter is hidden and the [ObjSlidePause] and [ObjSlidePauseIn] meters are shown (by the appropriate !SetOption bangs). But if in the X option of these meters, you're using the [#CURRENTSECTION#:W] variable, in the moment when the meter appears, its width is 0 (because previously it was hidden - the size of a hidden meter is 0) - so [#CURRENTSECTION#:W] is 0), but because it appeared, its width became 40. But the X option of the meter needs one update cycle to update its value. If instead of [#CURRENTSECTION#:W], you're using 40, its value is always 40, no matter if the meter is shown or hidden, so it'll take immediately its correct position.
A solution: add to the LeftMouseUpAction option of the [ObjSlidePlay] meter, the [!UpdateMeter "ObjSlidePause"][!UpdateMeter "ObjSlidePauseIn"][!Redraw] bangs and to the LeftMouseUpAction option of the [ObjSlidePause] and [ObjSlidePauseIn] meters, the [!UpdateMeter "ObjSlidePlay"][!Redraw] bangs. These will fix the problem, even if you're still using the [#CURRENTSECTION#:W] variable.
And one more: I'm not happy at all when I see this kind of bangs: [!SetOption ObjSlidePause Hidden 0], especially not from a such experimented guy like you. I'd use instead the [!ShowMeter "ObjSlidePause"]. Nonetheless using the !SetOption is the same well working, maybe it's just my fixed idea, that I don't like it.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Weird section variable positioning behavior

Post by Active Colors »

balala wrote:It's not weird at all! In fact it's an absolutely normal behavior, even if neither I wouldn't think to this before.
So the problem: when you click the [ObjSlidePlay] meter (I think it's a play button, right?), besides other actions, this meter is hidden and the [ObjSlidePause] and [ObjSlidePauseIn] meters are shown (by the appropriate !SetOption bangs). But if in the X option of these meters, you're using the [#CURRENTSECTION#:W] variable, in the moment when the meter appears, its width is 0 (because previously it was hidden - the size of a hidden meter is 0) - so [#CURRENTSECTION#:W] is 0), but because it appeared, its width became 40. But the X option of the meter needs one update cycle to update its value. If instead of [#CURRENTSECTION#:W], you're using 40, its value is always 40, no matter if the meter is shown or hidden, so it'll take immediately its correct position.
A solution: add to the LeftMouseUpAction option of the [ObjSlidePlay] meter, the [!UpdateMeter "ObjSlidePause"][!UpdateMeter "ObjSlidePauseIn"][!Redraw] bangs and to the LeftMouseUpAction option of the [ObjSlidePause] and [ObjSlidePauseIn] meters, the [!UpdateMeter "ObjSlidePlay"][!Redraw] bangs. These will fix the problem, even if you're still using the [#CURRENTSECTION#:W] variable.
And one more: I'm not happy at all when I see this kind of bangs: [!SetOption ObjSlidePause Hidden 0], especially not from a such experimented guy like you. I'd use instead the [!ShowMeter "ObjSlidePause"]. Nonetheless using the !SetOption is the same well working, maybe it's just my fixed idea, that I don't like it.
You are right. I simply forgot that hidden meters have zero properties. I stayed from rainmeter for a while and already forgot some bangs like !HideMeter too, so, I am sorry for that. I considered your recommendations and added and changed everything you wrote. Now everything works as intended.
Thank you balala for your respond. You keep your answers clear and informative as usual. :thumbup:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weird section variable positioning behavior

Post by balala »

Active Colors wrote:I stayed from rainmeter for a while and already forgot some bangs like !HideMeter too, so, I am sorry for that.
Don't be. As I wrote, finally neither setting the Hidden option of a meter is not wrong, I just consider this approach a bit more complicated. But for sure it is working.
Active Colors wrote:Thank you balala for your respond. You keep your answers clear and informative as usual. :thumbup:
You're welcome and I also thank for your appreciation.

Happy New Year.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Weird section variable positioning behavior

Post by fonpaolo »

If that's of any consolation, Active Colors, I can understand you very well, there's nothing to do, if you don't have time to "play" with Rainmeter almost regularly, you can forget many things even the simplest ones, in a few weeks.

Now, when I have to edit one of my skins, my most frequent thought is: I did this?
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Weird section variable positioning behavior

Post by Active Colors »

balala wrote:Don't be. As I wrote, finally neither setting the Hidden option of a meter is not wrong, I just consider this approach a bit more complicated. But for sure it is working.

You're welcome and I also thank for your appreciation.

Happy New Year.
Thank you! Happy New Year!
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Weird section variable positioning behavior

Post by Active Colors »

fonpaolo wrote:If that's of any consolation, Active Colors, I can understand you very well, there's nothing to do, if you don't have time to "play" with Rainmeter almost regularly, you can forget many things even the simplest ones, in a few weeks.

Now, when I have to edit one of my skins, my most frequent thought is: I did this?
Exactly. This is actaully one of the reasons I can't finish my skins. I start them, but then some things happen which don't let me finish skins right away. And after some time when I try to continue my projects I simply can't remember what I did there and start them almost from scratch. I think this is some form of autism.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Weird section variable positioning behavior

Post by fonpaolo »

Active Colors wrote:...I think this is some form of autism.
Well, if it's so, I too suffer of the same disease. ;-)
It's almost two years I'm trying to update my skin suite, ok, there were some new and cool features I wanted to use, but every time I have a few minutes and I start to edit skins... the time is wasted to remember what and how to do changes.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Weird section variable positioning behavior

Post by Active Colors »

fonpaolo wrote:Well, if it's so, I too suffer of the same disease. ;-)
It's almost two years I'm trying to update my skin suite, ok, there were some new and cool features I wanted to use, but every time I have a few minutes and I start to edit skins... the time is wasted to remember what and how to do changes.
I feel you. Me is you.