Solved

Open TDateTimePicker with code

Posted on 1998-01-15
5
184 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

16 Experts available now in Live!

Get 1:1 Help Now