?
Solved

Open TDateTimePicker with code

Posted on 1998-01-15
5
Medium Priority
?
192 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
[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
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month15 days, 9 hours left to enroll

741 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