How do I make a date and time selection in a Delphi application?

I want the user to be able to specify something like "Tuesday, 10am to 11am".

Can I do this with one complex control, or would I be better off with three separate simpler controls like combo boxes, one for the day and one for the start / stop?


source to share

2 answers

Would it be better if I had 3 combo blocks, one for the day and one for the start / stop?

Go for any solution that doesn't require natural language processing. It's less "cool" and may look a little dated, but I'm sure it's easier for users because they can do all the selection with their mice and always know they get what they want. Natural language is difficult, people can miss things, enter impossible data, or mislead data. What do you do if they enter something like this:

"MarΕ£i, de la 22 la 21"


(intentionally written in non-english, with a reverse hour in 24-hour format!). And don't even think about asking non-native English speakers to WRITE dates in English, torture.

In other words, if you don't have Google's ability to handle natural languages ​​in multiple languages, go for a simple multi-user setup with appropriate editors for each segment: one for the date, two times.



The JEDI VCL has many options.

If you want to do something like Google Calendar, where you can select a range from 9 to 11 hours, on a specific day, you can use JvTimeFramework (personal organizer) components. For viewing one day from a specific range to another specific range, the component is TJvTFDays


enter image description here

You click on the time you want to start, for example in Google Calendar. Then you type "Lunch with dave" and hit enter, then you take the bottom of the square and drag it up and down to fix the duration, or drag the top of the square up and down to change the start time. If you double click on it, you can directly enter it using the dialog box - the Add Appointment dialog shown in the screenshot is only available to one user. They can work without this and are simply entered directly on the day timer control page.

Otherwise, if you want to stick with text notation, I would combine multiple controls, including the JvDateTimePicker.

Check out the demo examples\JvTimeFrameWork\PhotoOp

in the JVCL examples folder for the above program.



All Articles