Delphi2010: unable to modfiy time in a datetimepicker component

hi all,

i would like to let a datetimepicker show date and times. And they must be editable.

after i ran the application, it is only possible to choose differt date/day, but i could not edit the hh:mm:ss.  any idea?

following are the codes i use:

procedure TForm1.FormCreate(Sender: TObject);
begin
  DateTimePicker1.Format := 'd MMM,yyyy hh:mm:ss';
end;

thanks,

wantime
wantimeAsked:
Who is Participating?
 
jimyXConnect With a Mentor Commented:
DateTimePicker seems to be not supporting to show the date and the time all together and give you the ability the change the time, you should separate them in two sets:

DateTimePicker1 to support the date and DateTimePicker2 to support the time.
0
 
jimyXCommented:
In that format you can change either the date or the time but not both, and that's based on the "DateTimePicker.kind". If it is dtkTime the time is changeable but the date is not, and if it is dtkDate then the date is changeable but the time is not.
 
0
 
wantimeAuthor Commented:
so, the only way is to use two DateTimePicker component to support both date and time?

it looks a litte bit weird...

is it impossible to combinate both in one box?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
jimyXCommented:
You can combine them, but you will be able to change only one, either the date or the time.
0
 
jimyXCommented:
I will look for a third party component that can support both date and time.
Will get back to you.
0
 
wantimeAuthor Commented:
thanks, i am also looking for it.
0
 
jimyXCommented:
After searching for that, found "Adrock DateTime Suite" which is old (Delphi 5):

http://www.adrock.com/Products/DelphiComponents.aspx

But the good thing it's free and source code provided. I couldn't manage to install all the components and get it working, so try it, if you want to give it a shot.

But I think using two Datetimepickers is going to be your option at the end.

0
 
ThommyCommented:
I assent to jimyX's solution:
Use 2 DATETIMEPICKERs, one with dtkDate kind and the other one dtkTime Kind.


You can put together the date and time as follows...

uses
DateUtils;

var
myDateTime :TDatetime;
begin
myDateTime := EncodeDateTime(YearOf(DateTimePicker_Date.Date), MonthOf(DateTimePicker_Date.Date), DayOf(DateTimePicker_Date.Date), HourOf(DateTimePicker_Hour.Time), MinuteOf(DateTimePicker_Hour.Time), SecondOf(DateTimePicker_Hour.Time),0);
0
 
ThommyConnect With a Mentor Commented:
You can also use 3rd party component ZVDateTimePicker

ZVDateTimeControls Package
http://wiki.freepascal.org/ZVDateTimeControls_Package#TZVDateTimePicker

Its property kind can have 3 values: dtkDate, dtkTime and dtkDateTime

dtkDateTime allows to change date and time together...
0
 
ThommyCommented:
Ooops, I've seen that ZVDateTimeControls is for FreePascal!!!

Sorry...
0
 
Ephraim WangoyaConnect With a Mentor Commented:

@wantime

This issue is fixed in Delphi2010 if you are going to upgrade some time in the near future

Otherwise
You can try TDateTimePickerEX which is a descendant of TDateTimePicker and is free with code and supports upto Delphi2009
Geert_Gruwez already listed it
http://www.be-precision.com/products/precision-utils/
0
 
wantimeAuthor Commented:
thanks. i have taken a look at http://www.be-precision.com/products/precision-utils/

but i don't know how to use the .pas and .dcr file.

i have not yet found out how to add the new TDateTimePicker to toolkits.
0
 
jimyXCommented:
In the Delphi IDE click File -> New Package -> in the right hand side, go to "contains" folder in "Project Manager" and right click 'add' then look for "DTPEx.pas" that you downloaded, then right click package.bpl and "install".
0
 
jimyXCommented:
For easy reference:

1.JPG
2.JPG
3.JPG
4.JPG
0
 
wantimeAuthor Commented:
thanks.

in  DTPEx.pas i saw the following commentar:

"The complete source code remains property of the author and may not be distributed,
published, given or sold in any form as such. "

the thing is the product i am developing will be sold. does it mean that i am not allowed to use these codes in my product?
0
 
jimyXConnect With a Mentor Commented:
That comment is talking about using the source code of the DTPEx component.

It also says:
"This unit can be freely used in any application."
So if you are not distributing the source code of the component along with your project, I do not see any violation here.

But if you are going to distribute the source code of the component then, as per the Author comment:

"No parts of the source code can be included in any other component or application without written authorization of the author."

Mainly that comment is for plagiarism violations. If in doubt just write to the author requesting permission:

info@be-precision.com
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.