Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1590

Community Tips & Tricks • Re: Handling Empty InputText

$
0
0
Hi guys!

I have a question and just what's bothering me are two things in which both of you intervene.
It's weight control. :oops:
The first is it possible to change the value of the input with a scroll?
The second is that I can't get the scale's reading to stay within the range of 45-65 and when the skin is refreshed, the reading varies towards another point, depending on which numbers, quite a bit.

{Code Clipped}

Thank you for your patience.
You cannot change the input value with a scroll.

But, you can use a scroll on the meter to take actions such as change the variable "Peso" value (see additions to the [TextSAtyle] section).
Clamping was added to the mouse scroll and to the user input command to keep those inputs and actions between the MinV/MaxV values.

The scroll or user input will set and write the new variable value; this and the code changes keep the vales when refreshed.

The 'StartingAngle' in your rotator meter [MtPeso] must be in radians, so I changed it to StartingAngle=(Rad(0)).

You didn't provide a kg.png image, so I fashioned one.

With those changes and creating variables for the min/max, you get this code and results.

Code:

[Rainmeter]Update=-1AccurateText=1MiddleMouseUpAction=!RefreshSolidColor=0,0,0,1[Variables]Peso=45MinV=45MaxV=65Verde=435a51Gris=808080Rojo=cb0000;----------------------------------------------------------;[STYLE];----------------------------------------------------------[TextStyle]StringAlign=CenterFontFace=GaramondFontColor=f6f6f6FontSize=10StringEffect=ShadowFontEffectColor=6a6a6aStringStyle=BoldAntiAlias=1LeftMouseUpAction=[!CommandMeasure "m#CurrentSection#" "ExecuteBatch 1"]DynamicVariables=1NumOfDecimals=1Padding=10,10,10,10SolidColor=0,0,0,1MouseScrollUpAction=[!WriteKeyValue Variables Peso "(Clamp(#Peso#+1,#MinV#,#MaxV#))"][!SetVariable Peso "(Clamp(#Peso#+1,#MinV#,#MaxV#))"][!Update]MouseScrollDownAction=[!WriteKeyValue Variables Peso "(Clamp(#Peso#-1,#MinV#,#MaxV#))"][!SetVariable Peso "(Clamp(#Peso#-1,#MinV#,#MaxV#))"][!Update];----------------------------------------------------------;[MEDIDAS];----------------------------------------------------------[mKg]Measure=CalcFormula=#Peso# MinValue=#MinV#MaxValue=#MaxV#DynamicVariables=1[mNumber1]Measure=CalcFormula=33.3[mNumber2]Measure=CalcFormula=33.4[mNumber3]Measure=CalcFormula=33.3[mPercent1]Measure=CalcFormula=( mNumber1 / ( mNumber1 + mNumber2 + mNumber3 ))[mPercent2]Measure=CalcFormula=( mNumber2 / ( mNumber1 + mNumber2 + mNumber3 ))[mPercent3]Measure=CalcFormula=( mNumber3 / ( mNumber1 + mNumber2 + mNumber3 ))[mPercent1%]Measure=CalcFormula=( 100 * mPercent1 )[mPercent2%]Measure=CalcFormula=( 100 * mPercent2 )[mPercent3%]Measure=CalcFormula=( 100 * mPercent3 )[MtNumber1]Meter=RoundlineMeasureName=mPercent1W=120H=120StartAngle=0RotationAngle=6.283LineStart=108LineLength=128LineColor=#Verde#Solid=1AntiAlias=1X=100Y=100DynamicVariables=1[MtNumber2]Meter=RoundlineMeasureName=mPercent2W=120H=120StartAngle=(2*PI*[mPercent1])RotationAngle=6.283LineStart=108LineLength=128LineColor=#Gris#Solid=1AntiAlias=1X=rY=rDynamicVariables=1[MtNumber3]Meter=RoundlineMeasureName=mPercent3W=120H=120StartAngle=(2*PI*([mPercent1]+[mPercent2]))RotationAngle=6.283LineStart=108LineLength=128LineColor=#Rojo#Solid=1AntiAlias=1X=rY=rDynamicVariables=1;----------------------------------------------------------;[TOPES];----------------------------------------------------------[MtPeso]MeasureName=mKgMeter=RotatorImageName=#@#Images\kg.pngStartAngle=(Rad(0))RotationAngle=(-2*PI)OffsetX=160OffsetY=160W=320H=320X=1Y=1DynamicVariables=1;----------------------------------------------------------;[INPUT];----------------------------------------------------------[mPeso]Measure=PluginPlugin=InputTextStringAlign=CenterInputLimit=3InputNumber=1W=30H=16X=226Y=([Peso:Y]+10)Command1=[!SetVariable Peso "(Clamp($UserInput$,#MinV#,#MaxV#))"][!WriteKeyValue Variables Peso "(Clamp([#CurrentSection#],#MinV#,#MaxV#))"][!Update]DefaultValue=#Peso#[Peso]Meter=StringMeterStyle=TextStyleText=#Peso#X=241Y=161
GIF 8-30-2024 7-44-49 PM.gif

Statistics: Posted by eclectic-tech — Yesterday, 11:53 pm



Viewing all articles
Browse latest Browse all 1590

Trending Articles