It is currently April 20th, 2024, 5:35 am

Problem with RedrawGroup

Get help with creating, editing & fixing problems with skins
durianpudding
Posts: 2
Joined: May 29th, 2021, 4:49 pm

Problem with RedrawGroup

Post by durianpudding »

Hi all,
I'm writing a skin with such two meters that when I move my mouse over meter 1, meter 2 will change its text. It works well with !SetOption followed by !Redraw, but I'm afraid it might cause performance problems so I switched to !RedrawGroup later. However, meter 2's text now doesn't update immediately, but only until the next update.
Here is a minimal code sample.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
BackgroundMode=2

[Meter2]
Meter=String
Text=meter2
Group=g1
Y=50
MouseOverAction=[!SetOption "Meter1" "Text" "changed"][!RedrawGroup "g1"]
MouseLeaveAction=[!SetOption "Meter1" "Text" "meter1"][!RedrawGroup "g1"]

[Meter1]
Meter=String
Text=meter1
Group=g1
Could anyone tell me what's wrong with the code? Thanks!
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Problem with RedrawGroup

Post by jsmorley »

!RedrawGroup is only effective with redrawing a group of "configs" (skins). It can't be used to redraw meter groups within a single skin.

https://docs.rainmeter.net/manual/bangs/#RedrawGroup

You are going to want [!UpdateMeterGroup "g1"][!Redraw]
durianpudding
Posts: 2
Joined: May 29th, 2021, 4:49 pm

Re: Problem with RedrawGroup

Post by durianpudding »

jsmorley wrote: May 29th, 2021, 5:23 pm !RedrawGroup is only effective with redrawing a group of "configs" (skins). It can't be used to redraw meter groups within a single skin.

https://docs.rainmeter.net/manual/bangs/#RedrawGroup

You are going to want [!UpdateMeterGroup "g1"][!Redraw]
oh thanks! :) I didn't even know skins can have groups!
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Problem with RedrawGroup

Post by balala »

durianpudding wrote: May 29th, 2021, 5:17 pm Could anyone tell me what's wrong with the code?
Note a detail of jsmorley's reply:
jsmorley wrote: May 29th, 2021, 5:23 pm It can't be used to redraw meter groups within a single skin.
In fact this means that there is no way to redraw one or the other meter of a skin. When you're using a [!Redraw] bang, it redraws the whole skin. No way to redraw only certain meter of the skin and this is why the !Redraw bang doesn't accept as parameter the name of a meter. It's only accepted parameter is the name of a another config, whose loaded skin (important to have a skin of that config loaded) this way is redrawn. But no way to redraw one single meter of the current skin.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Problem with RedrawGroup

Post by jsmorley »

Yes, it's probably worth reiterating what !Redraw is all about and how it works.

The update cycle of a skin more or less consists of:

Update all measures
Update all meters
Redraw the entire skin window
Spit, rinse and repeat

This happens on each update cycle, which is controlled at a high level by the Update option in the [Rainmeter] section.

So if you have something that you want to visibly happen NOW, rather than waiting until the next update cycle, you need to force the update of the elements you want to change, using !UpdateMeasure and / or !UpdateMeter. That will force the measures and / or meters to go get the latest values immediately. Then you follow up one or more of those bangs with a single !Redraw bang, which will force the window to be redrawn immediately.

!Redraw by itself is just pointless. It is meant to be used in conjunction with some form of forced update. The way to think of it is that !UpdateMeasure / !UpdateMeter go get the latest values, but have NO visible impact. !Redraw doesn't update any values, and ONLY causes Rainmeter to redraw the skin window using the current values.

!Redraw is relatively expensive in terms of resources, so it should only be used when you want to immediately force some change to one or more meters to be made visible NOW.