BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using TDateTime component

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Luigi Puleio
Guest





PostPosted: Thu Feb 23, 2006 9:03 am    Post subject: Using TDateTime component Reply with quote



Hello everyone...

I'm using a TDateTime component in a project as dkDate...I've figured I
can select date from dropdown calendar. But if, for example, I
increment/decrement day by pressing up/down key it is true it should
increment automatically also month and year when I'm at end/first of
month/year?

If not, do you have a suggest about making incrementing/decrementing
real date when using UP/DOWN button?

You see, I've tried to implement OnKeyDown/OnKeyUp event but it doesn't
work really good because it fires an event internally which
increments/decrements too the single value....

Thanks a lot in advance.
Ciao,
Luigi
Back to top
SF
Guest





PostPosted: Thu Feb 23, 2006 1:03 pm    Post subject: Re: Using TDateTime component Reply with quote



Quote:
You see, I've tried to implement OnKeyDown/OnKeyUp event but
it doesn't work really good because it fires an event
internally which increments/decrements too the single
value....

That would be easy to prevent. Just assign Key = 0 if you
already handled that key. For example:

void __fastcall TForm1::DateTimePicker1KeyDown(TObject *Sender,
WORD &Key,
TShiftState Shift)
{
if (Key == VK_UP)
{
/* your code to increment date */
Key = 0;
}
else if (Key == VK_DOWN)
{
/* your code to decrement date */
Key = 0;
}
}

HTH,

Stefano.
Back to top
Luigi Puleio
Guest





PostPosted: Thu Feb 23, 2006 3:03 pm    Post subject: Re: Using TDateTime component Reply with quote



Thanks you a lot! It works!
I should have figured about Key = 0 that makes keys to not be processed
till a new operation.

See you and thanks again!
Ciao, Luigi

SF wrote:
Quote:
You see, I've tried to implement OnKeyDown/OnKeyUp event but
it doesn't work really good because it fires an event
internally which increments/decrements too the single
value....


That would be easy to prevent. Just assign Key = 0 if you
already handled that key. For example:

void __fastcall TForm1::DateTimePicker1KeyDown(TObject *Sender,
WORD &Key,
TShiftState Shift)
{
if (Key == VK_UP)
{
/* your code to increment date */
Key = 0;
}
else if (Key == VK_DOWN)
{
/* your code to decrement date */
Key = 0;
}
}

HTH,

Stefano.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.