Página 1 de 1

TDateEdit Drop Down method

Publicado: Vie Ago 12, 2005 3:47 pm
por Mike Draper
How can I have a program drop down the calendar in a TDateEdit control?
I am trying to maintain keyboard access using F1 to various 'help'
functions. I can capture the keyup event but do not know how to make the
calendar drop down.
Mike Draper

TDateEdit Drop Down method

Publicado: Vie Ago 12, 2005 6:08 pm
por jfgimenez
Mike,
> How can I have a program drop down the calendar in a TDateEdit control?
>
> I am trying to maintain keyboard access using F1 to various 'help'
> functions. I can capture the keyup event but do not know how to make the
> calendar drop down.
This control actually shows the calendar on pressing the F4 key. The easyest
way to do it on pressing F1 is adding this code to your project:
CLASS TDateEdit FROM XDateEdit
METHOD WMKeyDown()
ENDCLASS
METHOD WMKeyDown( nKey, nFlags ) CLASS TDateEdit
IF nKey == VK_F1
nKey := VK_F4
ENDIF
RETURN Super:WMKeyDown( nKey, nFlags )
--
Un saludo,
José F. Giménez

TDateEdit Drop Down method

Publicado: Vie Ago 12, 2005 8:05 pm
por Mike Draper
Jose
Worked fine, of course.
This would seem to be the technique to modify any control class. Where can
I find out more about doing this type of thing?
I assume that 'WMKeyDown' refers to the Windows Message and 'Super' refers
to the standard message handling. This is great stuff. I need more
documentation or example.
"Jose F. Gimenez" <jfgimenez@wanadoo.es> wrote in message
news:[email=42fcc96b@ozsrvnegro.ozlan.local...]42fcc96b@ozsrvnegro.ozlan.local...[/email]
> Mike,
>
>> How can I have a program drop down the calendar in a TDateEdit control?
>>
>> I am trying to maintain keyboard access using F1 to various 'help'
>> functions. I can capture the keyup event but do not know how to make the
>> calendar drop down.
>
> This control actually shows the calendar on pressing the F4 key. The
> easyest way to do it on pressing F1 is adding this code to your project:
>
> CLASS TDateEdit FROM XDateEdit
> METHOD WMKeyDown()
> ENDCLASS
>
> METHOD WMKeyDown( nKey, nFlags ) CLASS TDateEdit
> IF nKey == VK_F1
> nKey := VK_F4
> ENDIF
> RETURN Super:WMKeyDown( nKey, nFlags )
>
> --
> Un saludo,
>
> José F. Giménez
>

TDateEdit Drop Down method

Publicado: Vie Ago 12, 2005 9:43 pm
por jfgimenez
Mike,
> Worked fine, of course.
Fine!
> This would seem to be the technique to modify any control class.
Yes, it is. This way you can add or modify any property or method from a
control without modifying the original Xailer's code.
> Where can I find out more about doing this type of thing?
There is a small introduction in the help file: "About Xailer" > "Class
Hierarchy" > " Object oriented programming"
> I assume that 'WMKeyDown' refers to the Windows Message and 'Super' refers
> to the standard message handling. This is great stuff.
Yes, it's exactly as you'd said.
> I need more documentation or example.
In general, every windows message (WM_xxxx) are routed to its corresponding
method WMxxxx in the class (note that the underscore (_) is not present in
the method name). The parameters nWParam and nLParam are always passed. If
there is no such method in the class, then the method HandleEvent( nMsg,
nWParam, nLParam ) is called, if it's present.
In either case, if there is no destination method or that method returns
Nil, then Xailer calls DefWindowProc() or CallWindowProc() with the original
WndProc handle.
This is the way Xailer runs. Of course, those windows messages are explained
in the API documentation (MS Platform SDK Help), and you need to read it if
you want to override any processing of them.
Most messages processing consist on doing something and / or calling its
corresponding event. I.e. WM_KEYDOWN launches the method WMKeyDown(), which
process any meaninfull key for that control or calls OnKeyDown() otherwise.
--
Regards,
Jose F. Gimenez