It is currently June 26th, 2019, 2:56 pm

New features in InputText

Changes made during the Rainmeter 4.0 beta cycle.
User avatar
jsmorley
Developer
Posts: 19272
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

New features in InputText

jsmorley » November 27th, 2016, 2:26 pm

We have added two new options to InputText:

InputLimit will limit the number of characters allowed in the input field.

InputNumber will only allow numeric input in the field.

Edit: Beta r2722 - We have changed the InputNumber option of the InputText plugin to support negative and fractional numbers.

A single - may be the first character, and a single . character may be entered anywhere in the input.
User avatar
killall-q
Posts: 285
Joined: August 14th, 2009, 8:04 am

Re: New features in InputText

killall-q » November 27th, 2016, 8:19 pm

Shouldn't InputNumber allow a decimal point? (maximum 1)
User avatar
jsmorley
Developer
Posts: 19272
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New features in InputText

jsmorley » November 28th, 2016, 12:47 am

killall-q wrote:Shouldn't InputNumber allow a decimal point? (maximum 1)
As of this writing, it will restrict it to positive, integer numeric characters (0-9).

We will look into supporting negative numbers and fractions, but be aware, it will NOT be a mask you can define. The only limit will be the total number of characters. This is just evaluating on a single character at a time basis. We have no intention of trying to wrestle this into "up to 3 integers and 1 decimal" or any such. Feel free to round the result you get from the user if you like, but it will be up to you.

Basically it will accept "0-9" "-" and "." as input characters.
User avatar
killall-q
Posts: 285
Joined: August 14th, 2009, 8:04 am

Re: New features in InputText

killall-q » November 28th, 2016, 1:28 am

I think something like this is great to have, because while you can accept and then reject non-conforming input with an informative dialog (then have them retype their input), it's much easier for the author, more intuitive, and less wasteful of the user's effort to not accept non-conforming input.
User avatar
jsmorley
Developer
Posts: 19272
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New features in InputText

jsmorley » November 28th, 2016, 1:33 am

killall-q wrote:I think something like this is great to have, because while you can accept and then reject non-conforming input with an informative dialog (then have them retype their input), it's much easier for the author, more intuitive, and less wasteful of the user's effort to not accept non-conforming input.
As much as I understand and agree with that reasoning, that's just not going to happen with the current architecture of InputText. We just can't easily "evaluate" the result, either during or after the input. The Windows Input control we use can have certain attributes like length and allowed characters set on it, but that is about the extent of it without a more radical re-design of InputText. That may happen, but it won't be either soon, or use the current InputText plugin. It would need to be something new.
User avatar
Brian
Developer
Posts: 1873
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: New features in InputText

Brian » November 28th, 2016, 5:33 am

This issue has been fixed for the next beta. Thanks for reporting.

It will now accept fractional values (only one '.' allowed), and negative values (the '-' needs to be the first character).
jsmorley wrote:We just can't easily "evaluate" the result, either during or after the input. The Windows Input control we use can have certain attributes like length and allowed characters set on it, but that is about the extent of it without a more radical re-design of InputText.
This is actually completely false (sorry jsmorley). We can evaluate the result as soon as character are pressed and when text is pasted into the textbox. While we have fixed the 'typing' of invalid values, we have not yet fixed the 'pasting' of invalid characters. The issue is slightly complicated due to some threading issues, but we are looking into it.

-Brian
User avatar
jsmorley
Developer
Posts: 19272
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New features in InputText

jsmorley » November 28th, 2016, 2:12 pm

Brian wrote:This issue has been fixed for the next beta. Thanks for reporting.

It will now accept fractional values (only one '.' allowed), and negative values (the '-' needs to be the first character).


This is actually completely false (sorry jsmorley). We can evaluate the result as soon as character are pressed and when text is pasted into the textbox. While we have fixed the 'typing' of invalid values, we have not yet fixed the 'pasting' of invalid characters. The issue is slightly complicated due to some threading issues, but we are looking into it.

-Brian
Well, I stand by my very careful statement... ;-)
easily "evaluate" the result
While we can certainly accept or reject any singe character based on what it is, and it's position in the string, it is not "easy" to have a user-defined mask, and evaluate the overall "result" as we go. I don't doubt it is possible, pretty much all things are possible. I suspect it would take some fairly complicated code, and the option required for the user to define this "mask" would be interesting to say the least.

I may well be missing something built-into C# that could help with this though.
User avatar
jsmorley
Developer
Posts: 19272
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New features in InputText

jsmorley » December 4th, 2016, 1:21 pm

In the latest r2722 beta of Rainmeter, we have changed the InputNumber option of the InputText plugin to support negative and fractional numbers.

A single - may be the first character, and a single . character may be entered anywhere in the input.