Page 1 of 1

BarBorder sucks. Here is one solution.

Posted: June 12th, 2017, 6:52 pm
by jsmorley
One small annoying thing about the Bar meter is how the BarBorder option works. While well intentioned when written long ago, it kinda misses the mark. The way it works it to always display some defined number of pixels of the image used in BarImage, but it forces an equal amount on both the left and right (horizontal bar) or top and bottom (vertical bar). This is not going to be what you want probably 90% of the time, as it effectively means you can never have a measured value of zero that works as expected. When the measure / meter is displaying zero, then at a minimum both the number of pixels defined in BarBorder, from BOTH the left and right of the image, will always be displayed.

We might fix this in the Bar meter one of these days, but here is a relatively easy temporary solution if you want to have some portion, presumably some number of pixels from the right-hand of the image, always displayed, while maintaining the accuracy of the measurement.

So first, create the image for your bar:
Bar300x20.png
Then create a second image, this will be just the portion of the bar image, or some other image you want, to use as the "border".
Border4x20.png
Then take a look a this skin to see a way to position this second image, using an Image meter, in the correct position in the X-axis to act the way you might expect.

Code: Select all

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

[MeasureLoop]
Measure=Loop
StartValue=0
EndValue=100
MinValue=0
MaxValue=100

[MeterBack]
Meter=Image
W=300
H=20
SolidColor=47,47,47,255

[MeterBar]
Meter=Bar
MeasureName=MeasureLoop
BarImage=#@#Images\Bar300x20.png
BarOrientation=Horizontal

[MeterBorder]
Meter=Image
X=(Clamp((300 * ([MeasureLoop]/100)),0,296))
ImageName=#@#Images\Border4x20.png
DynamicVariables=1
gif.gif

Re: BarBorder sucks. Here is one solution.

Posted: April 26th, 2018, 11:23 pm
by Yorky35
Nice post, thanks.