How to define/simulate input format for DropDownCalendar

forum.td.development (2005-2010)
StefanM
Germany
Posts: 662
Joined: 10 Aug 2018, 15:57
Location: Bavaria

How to define/simulate input format for DropDownCalendar

Post by StefanM » 07 Jan 2009, 15:17

 Posted by:  Stefan Misch 

Hi,

is there anybody out there that knows how to either define or simulate the
same behaviour for a DropDownCalendar with TD3.1 as for a normal date edit
field with a format mask of "dd.MM.yyyy" (german format) and input format
"99.99.9999" defined. The advantage is that for entering a date e.g.
"31.12.2008" you just have to type "311208" and because of the input format
the dots are added automatically and the century is added automatically on
validation when tabbing out because of the format mask.

DropDownCalendar has a method SetPicture(), but that only has influence on
the format mask but not the input format on data entry. Furthermore,
DropDownCalendar does not react on SAM_AnyEdit.

I attached a small sample just to clarify what I mean.

TIA,
Stefan

P.S.: Happy and Prosper New Year to everybody!

Attachment: cdkcomment.apt

Randy

How to define/simulate input format for DropDownCalendar

Post by Randy » 07 Jan 2009, 16:24

 Posted by:  Randy 

Hi,

this is a quick and dirty hack of what I do for calendar datafields.

Randy

StefanM
Germany
Posts: 662
Joined: 10 Aug 2018, 15:57
Location: Bavaria

How to define/simulate input format for DropDownCalendar

Post by StefanM » 09 Jan 2009, 17:56

 Posted by:  Stefan Misch 

Thanks, Randy - that works at least for validating.

But I really like to simulate the automatic addition of the dots, e.g.
after the first two digits of a date are entered to get the same
behaviour as if an input mask is set.

Isn't there somebody out there that knows what to do to make this thing
at least react on WM_KEYDOWN or simulate SAM_AnyEdit? Which messages
does this thing handle? When tracing the messages, I can see that it
gets a 0x0133 (WM_CTRCOLOREDIT?) on each key I press. In a rather naive
approach I use this message to post a SAM_AnyEdit to itsself.

But then I can't use EM_SETSEL to set the cursor carret at the end of
the field text. At least a SalPostMsg( cc1, EM_SETSEL, nlLen, nlLen )
does not show the expected effect, the cursor is still blinking at the
start and not at the end...

Thanks,
Stefan

kclench
United States of America
Posts: 72
Joined: 26 Jun 2017, 23:22
Location: Ventura, CA, USA

How to define/simulate input format for DropDownCalendar

Post by kclench » 18 Feb 2009, 22:04

 Posted by:  Karen Clench 

Randy -
Is there a way in this example to override the default behaviour of the
cCalendarDropDown when a date is entered with dashes between (Ie.
12-23-2008 mm-dd-yyyy ) ? As soon as I type the first - the value
becomes 31.12.1898
Thank you in advance,
Karen

Return to “td.development”

Who is online

Users browsing this forum: [Ccbot] and 0 guests