It is currently July 7th, 2020, 3:48 am

InputText issue with decimals

Report bugs with the Rainmeter application and suggest features.
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

InputText issue with decimals

Post by soyelrafa »

Hello! I found another issue with InputText.

When the values has decimals, the box it's not showed properly.

Example:

Code: Select all

X=5
Y=5
H=25
W=240
integers.png

Code: Select all

X=5.30
Y=5.30
H=25.30
W=240.57
decimals.png
I used the standar InputText skin to prove it: (I edited the X,Y, W and H values of [MeasureInput]. This is the only change between these two skins)

Without decimals:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
FirstVar=!WriteKeyValue
SecondVar=!SetVariable
FontSize=14

[MeterBackground]
Meter=Image
SolidColor=1E3A69FF
W=250
H=105

[MeasureInput]
Measure=Plugin
Plugin=InputText
SolidColor=76A0E8FF
FontColor=255,255,255,255
FontFace=Seqoe UI
StringStyle=Italic
FontSize=#FontSize#
X=5
Y=5
H=25
W=240
DefaultValue="Change Me!"
Command1=!WriteKeyValue Variables FirstVar "$UserInput$" "#CURRENTPATH#InputText.inc"
Command2=!Refresh #CURRENTCONFIG#
Command3=!SetVariable SecondVar "$UserInput$" Y=40 DefaultValue="Change Me Too!"
Command4=["$UserInput$"] Y=75 DefaultValue="Text file path and name"

[MeterWriteKeyValue]
Meter=String
X=5
Y=5
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
Text=#FirstVar#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 1-2"

[MeterSetVariable]
Meter=String
X=5
Y=10R
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=#SecondVar#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 3"

[MeterOpenEditor]
Meter=String
X=5
Y=10R
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=Open Text File
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 4"
With decimals:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
FirstVar=!WriteKeyValue
SecondVar=!SetVariable
FontSize=14

[MeterBackground]
Meter=Image
SolidColor=1E3A69FF
W=250
H=105

[MeasureInput]
Measure=Plugin
Plugin=InputText
SolidColor=76A0E8FF
FontColor=255,255,255,255
FontFace=Seqoe UI
StringStyle=Italic
FontSize=#FontSize#
X=5.30
Y=5.30
H=25.30
W=240.57
DefaultValue="Change Me!"
Command1=!WriteKeyValue Variables FirstVar "$UserInput$" "#CURRENTPATH#InputText.inc"
Command2=!Refresh #CURRENTCONFIG#
Command3=!SetVariable SecondVar "$UserInput$" Y=40 DefaultValue="Change Me Too!"
Command4=["$UserInput$"] Y=75 DefaultValue="Text file path and name"

[MeterWriteKeyValue]
Meter=String
X=5
Y=5
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
Text=#FirstVar#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 1-2"

[MeterSetVariable]
Meter=String
X=5
Y=10R
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=#SecondVar#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 3"

[MeterOpenEditor]
Meter=String
X=5
Y=10R
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=Open Text File
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 4"
Rainmeter Info:

Code: Select all

Rainmeter 4.4.0.3353 beta (64-bit)
Language: Spanish (3082)
Build time: 2020-06-08  9:37:48
Commit Hash: e3aef927
Windows 10 Pro 2004 64-bit (build 19041) - Spanish (3082)
Path: C:\Program Files\Rainmeter\
SkinPath: C:\Users\User\Documents\Rainmeter\Skins\
SettingsPath: C:\Users\User\AppData\Roaming\Rainmeter\
IniFile: C:\Users\User\AppData\Roaming\Rainmeter\Rainmeter.ini
EDIT: I forgot to put the screenshots of the issue, now they are included on the post.
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InputText issue with decimals

Post by jsmorley »

Size and position options in Rainmeter do not support fractional values. They are always full integers.

The only exception are size and position parameters in a Shape meter's Shape[N] option(s).
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: InputText issue with decimals

Post by soyelrafa »

jsmorley wrote:
June 11th, 2020, 2:01 pm
Size and position options in Rainmeter do not support fractional values. They are always full integers.
Yeah, I knew it, but I supposed it will round or floor the value because I don't have any issues on the rest of meters after changing the scale. But in this case it does.

I guess the solution to fix the scale will be then to convert the scaled value to integer before give it the value to the skin.
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InputText issue with decimals

Post by jsmorley »

soyelrafa wrote:
June 11th, 2020, 2:06 pm
Yeah, I knew it, but I supposed it will round or floor the value because I don't have any issues on the rest of meters after changing the scale. But in this case it does.

I guess the solution to fix the scale will be then to convert the scaled value to integer before give it the value to the skin.
Yes, it will always floor any fractional values.
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InputText issue with decimals

Post by jsmorley »

Code: Select all

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

[Variables]

[MeterImage]
Meter=Image
X=10.7
Y=20.4
W=100.6
H=50.3
SolidColor=255,0,0,90

[MeterString]
Meter=String
Y=10R
FontSize=14
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=[MeterImage:X] | [MeterImage:Y] | [MeterImage:W] | [MeterImage:H]

1.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InputText issue with decimals

Post by jsmorley »

If you want to round the value instead, you will have to explicitly do so:

Code: Select all

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

[Variables]

[MeterImage]
Meter=Image
X=(Round(10.7))
Y=(Round(20.4))
W=(Round(100.6))
H=(Round(50.3))
SolidColor=255,0,0,90

[MeterString]
Meter=String
Y=10R
FontSize=14
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=[MeterImage:X] | [MeterImage:Y] | [MeterImage:W] | [MeterImage:H]

2.jpg
You do not have the required permissions to view the files attached to this post.
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: InputText issue with decimals

Post by soyelrafa »

Perfect, this will solve the issue, thanks!
User avatar
balala
Rainmeter Sage
Posts: 10968
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: InputText issue with decimals

Post by balala »

jsmorley wrote:
June 11th, 2020, 2:08 pm
Yes, it will always floor any fractional values.
It floors or rounds the fractional values?
User avatar
Brian
Developer
Posts: 2020
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: InputText issue with decimals

Post by Brian »

Technically speaking, it just truncates at any character other numbers. 0123456789

This is an important difference from floor, specifically for negative values. Flooring a negative value basically rounds away from 0 - while flooring a positive value rounds toward 0.

Examples:

Code: Select all

X=10.1   Floor=10   Ceiling=11   Rainmeter=10
X=10.9   Floor=10   Ceiling=11   Rainmeter=10
X=-10.1  Floor=-11  Ceiling=-10  Rainmeter=-10
X=-10.9  Floor=-11  Ceiling=-10  Rainmeter=-10
All integer options in Rainmeter work this way.

-Brian
User avatar
balala
Rainmeter Sage
Posts: 10968
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: InputText issue with decimals

Post by balala »

Brian wrote:
June 11th, 2020, 5:14 pm
Technically speaking, it just truncates at any character other numbers. 0123456789

This is an important difference from floor, specifically for negative values. Flooring a negative value basically rounds away from 0 - while flooring a positive value rounds toward 0.

Examples:

Code: Select all

X=10.1   Floor=10   Ceiling=11   Rainmeter=10
X=10.9   Floor=10   Ceiling=11   Rainmeter=10
X=-10.1  Floor=-11  Ceiling=-10  Rainmeter=-10
X=-10.9  Floor=-11  Ceiling=-10  Rainmeter=-10
All integer options in Rainmeter work this way.

-Brian
Alright, thanks. Now it clearer.