简体   繁体   中英

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

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?

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.

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:

在此输入图像描述

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM