Solved

Open TDateTimePicker with code

Posted on 1998-01-15
5
186 Views
Last Modified: 2010-04-04
I wish to open a TDateTimePicker with code. How may this be accomplished? (The DropDown method does not work for this component, before you try!)
0
Comment
Question by:egarson
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
ronit051397 earned 50 total points
ID: 1356725
procedure TForm1.Button1Click(Sender: TObject);
begin
  DateTimePicker1.Setfocus;
  keybd_event(VK_F4,0,0,0);
  keybd_event(VK_F4,0,KEYEVENTF_KEYUP,0)
end;

0
 

Author Comment

by:egarson
ID: 1356726
Well done, Ronit!!

Why don't you comment the code a little so that we may benefit from your considerable wealth of knowledge? The two API calls are quite cryptic without any explanation.

Regards,

Edward
0
 

Author Comment

by:egarson
ID: 1356727
Ronit,

I just noticed that the code only works if the picker tpype is set to date; how does one open it if the type is set to Time?
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1356728
When you are focused on any combobox, and you press F4, the combo drops down. This code simulate the keystroke F4:
line 1 - setting the focus
line 2 - simulating F4 key down
line 3 - simulating F4 key up

If you set to Time mode, you cannot open a combo, even by clicking it, cause there is no combobox in time mode, or any other 'dropping' time screen.
0
 

Author Comment

by:egarson
ID: 1356729
Yes, I jumped the gun concerning dropping down the dktTime kind for TDateTimePicker....

Regards,

Edward
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

896 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now