The beauty of a date(time) formatted field

It took me some months to find this. And I only found it by accident so I can imagine there are a lot of you out there that don’t know this:

When you have a field, based on a datetime dataprovider there is a beautiful aspect of it.

Normally you would format a date field like ‘dd-MM-yyyy’, ‘MM/dd/yyyy’, ‘ddMMyy’ or whatever you want.

Now set the field to selectOnEnter and all content will be selected when you place the cursor in the field. So far nothing fancy!

Now click your or cursor and hey… The first (in my case day) value/portion of the field goes up and down. Great isn’t it? It works like a charm, respecting the complete calendar…

Now click your ( or) cursor and again wow… You can now step up and down through the month or year value…

Also double clicking on one portion of the field selects only that specific portion (day, month or year)…

I just couldn’t resist to share this one with you.

BTW you don’t have to make the field a calendar field just make it a text field and voila. This might be part of a solution to those that don’t like the standard Java calendar. For me that one is too ugly to work with, especially on mac.

IT2BE:
BTW you don’t have to make the field a calendar field just make it a text field and voila. This might be part of a solution to those that don’t like the standard Java calendar. For me that one is too ugly to work with, especially on mac.

Great tip. And it also works with calendar formatted field, so you can have both active at the same time…

IT2BE:
I just couldn’t resist to share this one with you.

Yes, very cool. Now the question is… Can we get the developers to watch for the tab key if the previous event was a double-click on the first value.

This would allow you to tab to the individual date parts WITHIN the field. This would prevent you from having to use the mouse.

Yes, that would be great. But if this can be done I would like it to be taken to the level of a keydown and mousedown event…

BTW you can step through with the right (not left) cursor. Once a value is selected you automatically go to the beginning of the next value. Clicking up and down again selects the complete (newly selected) value again…