Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select start of DateTimePicker

Status
Not open for further replies.

Pietjeparasietje

Programmer
Jun 13, 2005
55
NL
I've got a really stupid problem.
There's probably a real simpel way to fix it but I can't find it, so'll just post it.
Ive got 3 dateTimePickers everytime I select one I want to start at the beginning of this Time.
Right now if you have a time like this : " 08:45 AM " and I change the "45", then once I select the object again the "45" is selected. I want to select the "08" or just the begin every time a object is entered.
Hope someone knows how to do this,

Thnx Peter
 
I just did an experiment with this (Delphi 7) and the time edit always justifys to the right hand digits.

format was hh':'mm
Change the hours, re-focus and mins are selected.

You will notice that the windows digital clock keeps the last changed focus, it dosen't left justify so to speak.


Steve: Delphi a feersum engin indeed.
 
So what you're saying is that it is not possible to right justify so to speak?

Peter
 
sggaunt, where in the Delphi sourcecode does the Enter event select minutes. I can't find it myself.

You might solve your problem by creating a component derived from TDateTimePicker, and override the OnEnter event.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is always another way to solve it, but I prefer my way.
 
Indeed, If you could tell me how to select the hours or minutes of that DateTimePicker than it would be no problem..

Peter
 
That's the behavior I saw in the simple test I did, most things are possible.
I don't think there is a simple answer, as Nordlund says you can change the behaviour of most controls by overriding the default behaviours.

Nordlund: That's just what I saw when clicking the TDatetimepicker, so its not necessarily caused by default onenter ???? Do you see something else?


Steve: Delphi a feersum engin indeed.
 
No. I didn't saw any code at all regarding "OnFocus"

I was able to override OnEnter with the
Code:
procedure WMSetFocus(var Message: TWMSetFocus); message WM_SETFOCUS;


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"There is always another way to solve it, but I prefer my way.
 
...But if I removed the Inherited call, a also removed the focused text... So far so good...

I then tried to make a sendmessage routine to select the hour part of the text, but nothing happened...



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"There is always another way to solve it, but I prefer my way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top