Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow factional numbers in the text control for size tests. #74

Closed
owenca opened this issue Jul 20, 2017 · 6 comments
Closed

Allow factional numbers in the text control for size tests. #74

owenca opened this issue Jul 20, 2017 · 6 comments

Comments

@owenca
Copy link
Contributor

owenca commented Jul 20, 2017

The decimal mark should be disallowed for the "bytes" unit and localized to either '.' or ',' depending on the current locale.

Also, dragging & dropping a file should set the text to a value and unit that makes the most sense, e.g., 1.23 MiB instead of 1259.52 KiB or even worse, 1289748 bytes.

@owenca
Copy link
Contributor Author

owenca commented Jul 22, 2017

It seems Haiku doesn't support locale-sensitive decimal mark.

@humdingerb
Copy link
Member

Until we can find a solution, why not allow "." and "," in the size text control, and when saving the rule, replace the "," with a "." before converting to a float if that isn't done automatically?

When loading the rule, you can do something like the following to localize the rule's size float:

float fromRule = 123.45;
BString result;
BNumberFormat numberFormat;
status_t status = numberFormat.Format(result, fromRule);
if (status == B_OK)
	fPositiveNumberExampleView->SetText(result);

@owenca
Copy link
Contributor Author

owenca commented Jul 23, 2017

why not allow "." and "," in the size text control

The user can enter either '.' or ',' (or another decimal mark if there is more) depending on the current set locale.

@owenca
Copy link
Contributor Author

owenca commented Jul 23, 2017

Pulkomandy is implementing BNumberFormat::Parse(), which is the reverse of BNumberFormat::Format(). Then I can use it to hopefully complete the fix for this issue.

owenca added a commit to owenca/Filer that referenced this issue Jul 23, 2017
owenca added a commit to owenca/Filer that referenced this issue Jul 23, 2017
@owenca
Copy link
Contributor Author

owenca commented Jul 23, 2017

Well, It turns out that I don't have to use BNumberFormat::Parse() to complete the fix.

@humdingerb
Copy link
Member

I think it works well enough. Just for completeness, I mention what could be improved (probably once Parse() exists): People currently cannot use 1000-delimiters, e.g. 1,234.56 (or German: 1.234,56). It's not crucial, but what separates Filer from perfection. :)

Let's mark this fixed then with #76 . Thanks!

humdingerb pushed a commit to humdingerb/Filer that referenced this issue Aug 12, 2017
humdingerb pushed a commit to humdingerb/Filer that referenced this issue Aug 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants