[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Open TDateTimePicker with code

Posted on 1998-01-15
5
Medium Priority
?
194 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 200 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

834 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