In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

TDateEdit Drop Down method

Foro público de Xailer en español
Responder
Mike Draper
Mensajes: 41
Registrado: Vie Jul 01, 2005 11:59 pm

TDateEdit Drop Down method

Mensaje 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
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

TDateEdit Drop Down method

Mensaje 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
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Mike Draper
Mensajes: 41
Registrado: Vie Jul 01, 2005 11:59 pm

TDateEdit Drop Down method

Mensaje 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
>
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

TDateEdit Drop Down method

Mensaje 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
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Responder