textfield format mask issue

Hi all,

ok, i have created a new project, added one window with one textfield to make sure there was nothing interfering with this.
In the textfields mask property i have entered ##/##/#### and 99/99/9999 and 99/99/\2099
I have also entered the above into the format property.
The format does nothing when i enter a value. For example i enter 01012011 and it just displays that number.
The mask does something weird. If i enter 01 it instantly displays 0122/ and will allow no further input.
I thought something might be up with international date formats so i tried to enter 20 and it instantly displays 2022/ with no further input allowed.
I just want to format or mask the input to a date format. I am in Australia which uses the format of DD/MM/YYYY
Any ideas? I got the masks and formats from the dojo documentation, but i can’t figure out what is going on!

Cheers
Andrew

The entry ##/##/#### produces 01/31/2015 when 01312015 is entered for me.
Xojo 2014r2.1
Mac 10.10

Hi Roger,

Is that with format or mask set?

Cheers

I don’t get it.
If I enter ##/##/#### in mask when i enter 01 i get 0122/ and if i enter 31 i get 3122/
If i enter ##/##/#### in format nothing happens no matter what!

Grrrrrr! I think I’m loosing my mind!

Cheers for your help

OK, i figured it out.
I set my date/time prefs in System Preferences (on mac) to Chicago US and it works perfectly.
If I set it to Australia, all sorts of weirdness happens.
Looks like Australian Date/Time format is not supported by xojo?
Thats pretty bad. Is there any way anyone can think of around this?
Cheers.

In the UK we use the same date format as Oz, and I use the same mask as you have written and it works here. There must be something else going on.

Confirmed. If I set my location to London UK it works fine. Set it back to Australia, Brisbane - No go. All sorts of weirdness.
It is definitely to do with the location being set to Aus. Not the Date format for location. Maybe xojo does not have the Australian location format set? I don’t know! Is there some workaround? I can’t ask my client to change their location settings as it would change the time.
How can I get around this?
Cheers

by the way, I would really like to have one of those beers you are drinking in your profile pic. Although you guys drink it warm, don’t you? I love an ice cold beer. LOL

Is there perhaps a way to overwrite the date format xojo gets from your location to manually set it to one that is the same but works?
For example can I set the date format to UK even though system settings say I’m in aus? That way the date mask should work and the time would be correct. I know in VFP you could do this, not sure if there is the option in xojo?

in VFP you could enter
SET Date BRITISH
and it would use the british date format regardless of location settings.

[quote=163583:@Andrew Willyan]Confirmed. If I set my location to London UK it works fine. Set it back to Australia, Brisbane - No go. All sorts of weirdness.
It is definitely to do with the location being set to Aus. Not the Date format for location. Maybe xojo does not have the Australian location format set? I don’t know! Is there some workaround? I can’t ask my client to change their location settings as it would change the time.
How can I get around this?
Cheers[/quote]

“All sorts of weirdness” is not exactly precise. Could you post examples with what you input, how you try to format, and what the result is ?

Here is a way with the new framework :

[code] 'http://developer.xojo.com/date
dim d as xojo.core.date
d = xojo.core.date.Now

'http://developer.xojo.com/locale
dim L as new xojo.core.Locale(“en-au”)

msgbox d.ToText(L, Xojo.core.Date.FormatStyles.Short, Xojo.Core.Date.FormatStyles.None)[/code]

Hi Michel.

I have posted several examples in previous posts.
This was all done in a fresh (new) project so as nothing could interfer. New project-add window-add textfield-change mask to ##/##/####
Run project.
If my location in system preferences on a Mac running Mavericks is set to Australia the following happens.
If I enter 01 into the textfield, it instantly (without pressing enter or any other key) displays 0122/ and will not allow any further input. I have tried all sorts of numbers thinking maybe I have to enter the year first, so I entered 20 and it instantly displayed 2022/
If I change my location to uk in system preferences when I enter 01 it displays 01/ as expected then allows me to enter 01 again displaying 01/01/ then allows me to enter 2015 displaying 01/01/2015 as expected.
Does this help?
Thanks
Andrew.

[quote=163601:@Andrew Willyan]Hi Michel.

I have posted several examples in previous posts.
This was all done in a fresh (new) project so as nothing could interfer. New project-add window-add textfield-change mask to ##/##/####
Run project.
If my location in system preferences on a Mac running Mavericks is set to Australia the following happens.
If I enter 01 into the textfield, it instantly (without pressing enter or any other key) displays 0122/ and will not allow any further input. I have tried all sorts of numbers thinking maybe I have to enter the year first, so I entered 20 and it instantly displayed 2022/
If I change my location to uk in system preferences when I enter 01 it displays 01/ as expected then allows me to enter 01 again displaying 01/01/ then allows me to enter 2015 displaying 01/01/2015 as expected.
Does this help?
Thanks
Andrew.[/quote]

I did not understand you wanted to have a TextField that acts intelligently.

The Mask property only formats whatever number you give it the way you want. It has no knowledge of which is what.

To obtain the kind of behavior you describe from the TextField while the system itself is set to another locale, for instance en-us while you want the date to be en-au, you will have to manage that behavior yourself, looking at what is in TextField.Text in TextChanged. There is no way I know of to set a TextField to a different local preference than the whole system.

Well to be honest, I don’t want it to do that. I want it to work with the locale set to Aus. But it does not work. It only works if I set it to another locale. I want it to format correctly to Aus, but it throws those issues. I thought a work around might be to manually set it to uk as they have the same date format as aus.
The issue is that the mask property does not format the text as expected. The mask ##/##/#### does not format the text like that if set to Aus locale, but does if set to uk locale in the os system settings.
This is a bug to do with xojo and Aus locale. Just thought there might be a work around by manually setting the locale in xojo.
You could try it yourself if you wish. Set your locale in your os system setting to Aus and try to get the mask property to work. You should get the same issues as me.

Cheers again.

[quote=163611:@Andrew Willyan]Well to be honest, I don’t want it to do that. I want it to work with the locale set to Aus. But it does not work. It only works if I set it to another locale. I want it to format correctly to Aus, but it throws those issues. I thought a work around might be to manually set it to uk as they have the same date format as aus.
The issue is that the mask property does not format the text as expected. The mask ##/##/#### does not format the text like that if set to Aus locale, but does if set to uk locale in the os system settings.
This is a bug to do with xojo and Aus locale. Just thought there might be a work around by manually setting the locale in xojo.
You could try it yourself if you wish. Set your locale in your os system setting to Aus and try to get the mask property to work. You should get the same issues as me.

Cheers again.[/quote]

If only I knew what Australian locale is, it would be a lot easier. Is it DD/MM/YYYY ?

Once again, what do you want to obtain ?

Yes. Aus format is DD/MM/YYYY
I want to obtain when I enter a number for example 01 (that way it should work regardless of if it is a DD or MM) it should accept 01 then display the date separator / and allow the next 2 numbers. That works if I change my system preferences to uk. But if my system preferences are set to Australia when I enter the first 2 numbers 01 instead of displaying the date separator / and allow me to enter the next 2 numbers it displays 0122/ and will not allow any further input.

[quote=163617:@Andrew Willyan]Yes. Aus format is DD/MM/YYYY
I want to obtain when I enter a number for example 01 (that way it should work regardless of if it is a DD or MM) it should accept 01 then display the date separator / and allow the next 2 numbers. That works if I change my system preferences to uk. But if my system preferences are set to Australia when I enter the first 2 numbers 01 instead of displaying the date separator / and allow me to enter the next 2 numbers it displays 0122/ and will not allow any further input.[/quote]

I am sorry, but with Xojo 2014R3.2 and the system set to English-Australia, with a mask ##/##/### if I enter 01 it displays 01/ and if I add 22 it displays 01/12/ Then if I go 2015 I get 01/12/2015.

As expected there is no checking that the days don’t go over 31, or that the months don’t go over 12, but the format is conformant to the mask.

Something else must be going on. Here is the test program I made in which I see this.

http://fontmenu.com/xojo/dateTF.xojo_binary_project

ok.
Further testing. The above project you linked does the same bad behaviour for me on Mac Mavericks.
I run remote debugger and it works fine in Windows 8.1
Were you testing on Mac or PC?
Thanks for your time and effort so far.

Also I am on Xojo 2014R3.2 Mac 10.10.2
Also i tried to set location manually to Australia (instead of set timezone automatically using location)

If someone could test the above link project on a mac with location set to aus that would be awesome.
See if its just me!
Cheers