Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Delphi2010: unable to modfiy time in a datetimepicker component

Posted on 2010-11-24
17
Medium Priority
?
1,080 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:wantime
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 4
  • 3
  • +2
17 Comments
 
LVL 24

Accepted Solution

by:
jimyX earned 1000 total points
ID: 34204322
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
 
LVL 24

Expert Comment

by:jimyX
ID: 34204447
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
 

Author Comment

by:wantime
ID: 34204827
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 24

Expert Comment

by:jimyX
ID: 34204846
You can combine them, but you will be able to change only one, either the date or the time.
0
 
LVL 24

Expert Comment

by:jimyX
ID: 34205046
I will look for a third party component that can support both date and time.
Will get back to you.
0
 

Author Comment

by:wantime
ID: 34205098
thanks, i am also looking for it.
0
 
LVL 24

Expert Comment

by:jimyX
ID: 34205794
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
 
LVL 19

Expert Comment

by:Thommy
ID: 34206097
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
 
LVL 19

Assisted Solution

by:Thommy
Thommy earned 500 total points
ID: 34206231
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
 
LVL 19

Expert Comment

by:Thommy
ID: 34206356
Ooops, I've seen that ZVDateTimeControls is for FreePascal!!!

Sorry...
0
 
LVL 32

Assisted Solution

by:Ephraim Wangoya
Ephraim Wangoya earned 500 total points
ID: 34210680

@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
 

Author Comment

by:wantime
ID: 34221670
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
 
LVL 24

Expert Comment

by:jimyX
ID: 34221702
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
 
LVL 24

Expert Comment

by:jimyX
ID: 34221838
For easy reference:

1.JPG
2.JPG
3.JPG
4.JPG
0
 

Author Comment

by:wantime
ID: 34257152
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
 
LVL 24

Assisted Solution

by:jimyX
jimyX earned 1000 total points
ID: 34257282
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question