Dynamic & Reactive user interface
Creating a module with a reactive user interface can be achieved in Rainmeter with inline formulas and mouse action bangs.
In most cases, you do not want to use fixed dimensional values for anything. This includes X Y W H R StrokeWidth FontSize
. The only case that you will have fixed values for anything is if your module is generated from a lua / ps1 script.
Scaling
To make a module which can scale according to W H
and Scale
you'll need to have position & dimensional options for meters set with inline formulas.
The simplest form of an inline formula is X=(150*#Scale#)
This tells Rainmeter to scale your X value according to the Scale
variable.
Every inline formula must be contained in a bracket
To scale any meter is as simple as multiplying their positional and dimensional values.
Aligning
Most Rainmeter element (except for a few) is aligned from it's top left corner. Therefore, you can't just set a meter's X value to (#W#/2)
and expect it to center
Center
General formula: =(#Total#/2-#Group#/2)
Total is the sum of dimensional units to align the Group center Group is the sum of dimensional units to be aligned center
However, for string
and shape
meters, you can use alternative ways to center them
Side
Aligning left general formula: =(#AnchorDim#+#OffSet#)
Aligning right general formula: =(#AnchorDim#-#OffSet#-#Group#)
AnchorDim is the dimensional positional value where the meter is aligned at OffSet is the distance between the alignment anchor and the meter Group is the sum of dimensional units to be aligned right
Using R
or r
you can sometimes omit using #AnchorDim#
. More on the Rainmeter wiki:
https://docs.rainmeter.net/manual/meters/general-options/#XY
And again, there are other ways to center String
and Shape
Meters. No examples will be given, as you can probably figure it out 😛
Synergizing scale & align
You can use both scaling and aligning to create complex scaleable elements. Example: #creating-a-meter-style
MouseActions
A generic mouse over mouse leave action looks like this
However, you can't configure a shape's inline options with !SetOption
. This is what you should do alternatively.
Last updated