Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I do a date and time range selection in my Delphi application?

Tags:

delphi

vcl

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

Can I do this with one complex control, or would I be better off with 3 separate simpler controls, such as combo boxes, one for day and one each for start/stop times?

like image 853
Mawg says reinstate Monica Avatar asked Dec 16 '22 03:12

Mawg says reinstate Monica


2 Answers

Would I be better off with 3 combo boxes, one for day and one each for start/stop times?

Go for whatever solution doesn't require natural language processing. It's less "cool" and might look a bit obsolete, but I bet it's easier for users because they can do all the selection with the mice and always know they get what they want. Natural language is hard, people might miss-spell things, enter impossible data or confusing data. What do you do if they enter something like this:

"Marţi, de la 22 la 21"

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

In other words, unless you have Google's ability to process natural languages in multiple languages, go for a plain multi-combo-box setup, with proper editors for each segment: one for date, two for times.

like image 91
Cosmin Prund Avatar answered May 10 '23 23:05

Cosmin Prund


The JEDI VCL has a plethora of options.

If you want to be able to do something like the Google Calendar where you can select a range from say, 9 to 11 am visually, on a particular day, you can use the JvTimeFramework (personal organizer) components. For a single day view with times from a particular range to another particular range, the TJvTFDays component is ideal:

enter image description here

You click on the time where you want to start, like Google Calendar does. Then you type "Lunch with dave" and hit enter, then you grab 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 it, you can directly input using a dialog box -- the Add Appointment dialog shown in the screenshot is only one option users have. They can work without that, and just directly input onto the day-timer page control.

Otherwise, if you want to stick to text entry, I would combine several controls, including a JvDateTimePicker.

Check out the examples\JvTimeFrameWork\PhotoOp demo in the JVCL examples folder for the above program.

like image 38
Warren P Avatar answered May 11 '23 00:05

Warren P