Skip to content

Improve number field#101

Open
NeutronSelector wants to merge 2 commits intoGTNewHorizons:masterfrom
NeutronSelector:improve-number-field
Open

Improve number field#101
NeutronSelector wants to merge 2 commits intoGTNewHorizons:masterfrom
NeutronSelector:improve-number-field

Conversation

@NeutronSelector
Copy link

fix an excption occurd when TextFieldWidget is initilized like this :
new TextFieldWidget().setFormatAsInteger(true).width(width).height(12);

In this cas, if user enter a non-numeric char in the filed, InvalidNumberException thrown.

Improve QOL when a field is numric, remove all non numeric chars onRemoveFocus instead set 0.

return 0.0;
}
}
num = num.replaceAll("\\D+", "");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats this for?

Copy link
Author

@NeutronSelector NeutronSelector Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this : Improve QOL when a field is numric, remove all non numeric chars onRemoveFocus instead set 0.
Before, when user leave focus
1556e => is set to 0, test55test55 => 0
After
1556e => is set to 1556, test55test55 => 5555

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not desired behaviour. It will break expressions for example.

private IStringValue<?> stringValue;
private Function<String, String> validator = val -> val;
private boolean numbers = false;
private boolean isNumber = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why rename?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the name for a boolean is not explicit in my opinion. But i rollback if you want.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, roll this back. It just makes backporting commits harder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants