MattNY177 wrote: ↑September 4th, 2021, 4:37 am
Yes I understand that, thanks again for your advice. However in this case I was suggesting if you have all 100 boxes in the same group, so you can toggle them to show/hide only the ones that are up to the BoxCount all at once. So for example, if BoxCount=80, when you trigger the toggle it will only unhide those 80 boxes, the other 20 will remain hidden. Then, if you change the BoxCount=40, the same toggle will only show 40 boxes instead of 80, and the other 60 will remain hidden.
It seems like this would require using !SetOption to switch between Hidden=1 and Hidden=(#BoxCount# < X) where X is equal to the individual meter's index. It would also be possible if there was some way to revert those meters back to their original values using !SetOption without refreshing the skin. Otherwise, I would need to manually add and remove each meter from the group whenever I want to change the number of Boxes being toggled.
Does that make sense or am I just misunderstanding something?
Yes, that makes sense. So in this scenario, you are changing the value of #BoxCount# on the fly. For this to dynamically hide/show your meters, you need to add
DynamicVariables=1 to every meter. Then, all the meters will hide or show as needed, depending on the expression. Without DynamicVariables, the meters won't re-evaluate the expression and it will have it's original state it had when the skin started. But with it, it is checked on each update. You can force an update and immediately redraw the skin if you need an instant response, otherwise you can wait a second (or whatever your update rate is) for the meters to be updated and redrawn accordingly.
Here's a simple example. (I'm using a Loop measure to twiddle the BoxCount variable just for an example.)
Code: Select all
[Rainmeter]
AccurateText=1
DynamicWindowSize=1
[Variables]
BoxCount=1
[BoxStyle]
FontColor=255,255,255
FontSize=12
SolidColor=0,0,0
Y=20r
[MeasureLoop]
Measure=Loop
StartValue=0
EndValue=3
OnUpdateAction=[!SetVariable BoxCount [MeasureLoop]]
[Box1]
Meter=String
MeterStyle=BoxStyle
Text=Box 1
Y=0
Hidden=(#BoxCount# < 1)
DynamicVariables=1
[Box2]
Meter=String
MeterStyle=BoxStyle
Text=Box 2
Hidden=(#BoxCount# < 2)
DynamicVariables=1
[Box3]
Meter=String
MeterStyle=BoxStyle
Text=Box 3
Hidden=(#BoxCount# < 3)
DynamicVariables=1
I'm using a style to apply similar attributes to all the box meters. You can add the DynamicVariables in the style instead, but I left it out just so you can see.
If you want to use Groups instead, that is a whole different scenario. In that case, you'd use a completely different approach where you'd hide and show items using group bangs (not !SetOption).