I’m showing a number (double) in a TextField, that the user may edit. The format and mask of the field are 999.9 (not sure they are right, btw).
In my region, the decimal separator is a comma, mathematically speaking. When it comes to computer, I’m not sure. Being a programmer, I’m accustomed to the fact that I should use the period. Also, IIRC, Excel expects a period given my regional settings (can’t test, as I currently don’t have Excel registered). All this confuses me as to what external users expect.
With this format (999.9), the accepted input is the comma, but it looks weird to me, having used periods more than commas in computers. I guess if the period was the accepted character, I’d find it weird too
Returns as a string a formatted version of the number passed based on the parameters specified. The Format function is similar to the way spreadsheet applications format numbers. Format will use the information based on the users locale even if the users locale is a Unicode-only locale.
In short, Format returns the number with the user OS settings, you do not have to worry about that.
Now, if you ask about how many digits after the decimal separator
the ui should use the user settings.
i prefer to make a extra value input control, a class or container control with super set to TextEdit.[/quote]
Thanks. I’m already using a subclass. the ui should use the user settings. is the answer I was looking for.
Returns as a string a formatted version of the number passed based on the parameters specified. The Format function is similar to the way spreadsheet applications format numbers. Format will use the information based on the users locale even if the users locale is a Unicode-only locale.
In short, Format returns the number with the user OS settings, you do not have to worry about that.
Now, if you ask about how many digits after the decimal separator [/quote]
Thanks Emile. In fact, I saw that extract from the LR. But, when I use Excel, the decimal separator is a period (in my region; said from memory as I can’t open Excel at the moment), where the Xojo’s Format function uses a comma.
System Preferences’ regional settings are also rather misleading: the number example shows 1 234,56 while the currency example tells 4 567.89 (note the difference of separators used).
I do not have that in my French OS / French software.
But, you can change that in your OS (if macOS, it certainly is possible uner the two other OSes too) easilly.
That said, people use all and nothing as separator(s); I even saw a 1950 way of wrtiting a price (50 25 that is in fact 50,25 ).
And I do not talk about the phone number separator (space, dot,comma, -, and so on
At last, for us developer using Xojo (or others), we use the comma for one thing and the dot for another. In French, the decimal separator is the comma while in Xojo it is used to build a list
The main problem come from habits and reality.
The song La Marseillaise was written by Rouget de lIsle whose spelling have been modified sincI learned it at elementary school ! What to say about the Tea from Ceylan ? (Sri Lanka nowadays) and Mumbai ?
Indeed, I have the Swiss French settings. And I won’t change them since I need them. It’s still true that, on a system set like that, differentiating commas and periods is not-so-easy.
Granted, people use a variety of wrong separators; perhaps because it’s hard to remember them all, especially if you also happen to know foreign ones.
macOS will also let you set them to just about anything you want which is always a fun exercise to try and make the separator not just a , or . but a multicharacter string like “{}[]”
Then you find out who isnt reading the system setting
[quote=459335:@Norman Palardy]macOS will also let you set them to just about anything you want which is always a fun exercise to try and make the separator not just a , or . but a multicharacter string like “{}[]”
Then you find out who isnt reading the system setting :)[/quote]
Hmm I’ll play with that. I’m already using morning and afternoon strings in my time formats, although I use hours up to 23 and wouldn’t need these strings. Customising things is really fun
at least in Xojo you can find those settings pretty easily
Dim thousandsSeparator As String = ReplaceAll( Format( 1111, "0,000"), "1", "")
Dim decimalSeparator as string = ReplaceAll( Format( 1.1, "0.0"), "1", "")
many times I just have these two as methods in an Internationalization module
you could cache them as Xojo doesnt seem to pick up changes of those settings when the app is already running