Any way to programatically allow the user to type a date? Day TAB month TAB Year.
Most professionals want to type, not click their date.
Any way to programatically allow the user to type a date? Day TAB month TAB Year.
Most professionals want to type, not click their date.
So, donât use that.
Add a TextField,
Add a mask â##/##/####â; use the date separator for your country
Add a LostFocus Event and there:
Set the typed date to a DateTime,
Test of the DateTime variable is OK,
Continue as if it comes from a DDTP,
Not Valid ? Clears the TFand issue a bip
Is it clear ?
You can type: Day (keyboard right arrow) Month (keyboard right arrow) Year.
My used code is:
Var myToday As New DateTime(2000,01,01)
// Fill the DateTime with the date string
Try
// Test if the date is correct
myToday = DateTime.FromString(TF_Date.Text, French_Loc, Nil)
// Assign the date to your Property (below
Catch
// Error: eitheir the format is incorrect or the date is wrongâŠ
Beep
TF_Date.Text = ""
Return
End Try
And that allows to type the Day TAB Month TAB Year?
I use right arrow I think, but I forget.
Other thing I forget is the Hint: JJ/MM/AAAA for French Locale.
What I donât like about a mask is that I canât type:
4 â 9 â 1970
â is the right arrow on the keyboard
but I can do that with a DesktopDateTimePicker.
Better: the â/â appears by magic after you typed two numbers⊠;).
Admittedly it would be helpful if you could also use Tab instead of the cursor keys (because users might expect they could tab from field to field) but yes, it is certainly possible to type in a date using the non-graphical picker.
Iâve found no way to add tabbing to the picker as it doesnât appear to be possible to change the selected part of the date (day, month, or year) programmatically, or even to determine which part is currently selected.
Of course one could easily create a container control as a replacement for the standard control. Making that work for multiple locales would require more effort though.
Maybe create a Feature Request to see if Xojo can add an option to âallow TABâ within the DesktopDateTimePicker.
Edit: looks like the TAB feature is missing from Xojoâs control, this is how it looks with macOS own control using TAB:
Iâm sure @Javier_Menendez can add that feature to the control. Maybe Stephen can create a Feature Request (I can do it later if no one creates it).
I prefer not to write 2 numbers for day/month that are only 1. Thanks.
The Einhugur DateControl allows you to tab between fields.
Thank you. Issue created:
I use a superclass for textbox for date where I can enter â;â for current date, â0405â for 04/05 of current year and 040524 for 04/04/2024