 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Luigi Puleio Guest
|
Posted: Thu Feb 23, 2006 9:03 am Post subject: Using TDateTime component |
|
|
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
|
Posted: Thu Feb 23, 2006 1:03 pm Post subject: Re: Using TDateTime component |
|
|
| 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
|
Posted: Thu Feb 23, 2006 3:03 pm Post subject: Re: Using TDateTime component |
|
|
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 |
|
 |
|
|
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
|
|