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.

OnKeyDown Event ....

Xailer professional forum in English
Responder
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

OnKeyDown Event ....

Mensaje por ChrisGillard »

Hi,
I am trying to detect certain keys in an edit control using the OnKeyDown
event with code like this .......
METHOD CodeEditKeyDown( oSender, nKey, nFlags ) CLASS TMainForm
do case
case nKey == VK_UP
LogDisplay( "CodeEditKeyDown()", nkey, "VK_UP" )
case nKey == VK_DOWN
LogDisplay( "CodeEditKeyDown()", nkey, "VK_DOWN" )
case nKey == VK_F10
LogDisplay( "CodeEditKeyDown()", nkey, "VK_F10" )
endcase
RETURN Nil
It sort of works but ....
1. I get 2 Logdisplay messages for 1 K_UP or 1 K_DOWN key press ..... I
would have expected only one Logdisplay per key down ? What is going on
please ? ( see attached image )
2. I get nothing for the Function key F10. I oresume these are being
trapped somewhere else ?? How can I detect these ? ( I am not a great fan of
SetKey())
Some wisdom would be appreciated.
Regards
Chris Gillard


Attached files
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

OnKeyDown Event ....

Mensaje por ChrisGillard »

Solved it ....
I need to return 0 from the OnKeyDown event to cancel any further standard
processing of any key actioned.
Now I only get a single LogDisplay() message.
I still dont know where the F Keys are going ... maybe I do have to use
SetKey() ??
Regards
Chris Gillard
"Chris Gillard" <chris@bluesquare.co.uk> wrote in message
news:47c44daf$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Hi,
>
> I am trying to detect certain keys in an edit control using the OnKeyDown
> event with code like this .......
>
> METHOD CodeEditKeyDown( oSender, nKey, nFlags ) CLASS TMainForm
> do case
> case nKey == VK_UP
> LogDisplay( "CodeEditKeyDown()", nkey, "VK_UP" )
> case nKey == VK_DOWN
> LogDisplay( "CodeEditKeyDown()", nkey, "VK_DOWN" )
> case nKey == VK_F10
> LogDisplay( "CodeEditKeyDown()", nkey, "VK_F10" )
> endcase
> RETURN Nil
>
> It sort of works but ....
>
> 1. I get 2 Logdisplay messages for 1 K_UP or 1 K_DOWN key press ..... I
> would have expected only one Logdisplay per key down ? What is going on
> please ? ( see attached image )
>
> 2. I get nothing for the Function key F10. I oresume these are being
> trapped somewhere else ?? How can I detect these ? ( I am not a great fan
> of SetKey())
>
> Some wisdom would be appreciated.
>
> Regards
>
> Chris Gillard
>
>
>
>
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

OnKeyDown Event ....

Mensaje por ChrisGillard »

Solved it ....
I need to return 0 from the OnKeyDown event to cancel any further standard
processing of any key actioned.
Now I only get a single LogDisplay() message.
I still dont know where the F Keys are going ... maybe I do have to use
SetKey() ??
Regards
Chris Gillard
"Chris Gillard" <chris@bluesquare.co.uk> wrote in message
news:47c44daf$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Hi,
>
> I am trying to detect certain keys in an edit control using the OnKeyDown
> event with code like this .......
>
> METHOD CodeEditKeyDown( oSender, nKey, nFlags ) CLASS TMainForm
> do case
> case nKey == VK_UP
> LogDisplay( "CodeEditKeyDown()", nkey, "VK_UP" )
> case nKey == VK_DOWN
> LogDisplay( "CodeEditKeyDown()", nkey, "VK_DOWN" )
> case nKey == VK_F10
> LogDisplay( "CodeEditKeyDown()", nkey, "VK_F10" )
> endcase
> RETURN Nil
>
> It sort of works but ....
>
> 1. I get 2 Logdisplay messages for 1 K_UP or 1 K_DOWN key press ..... I
> would have expected only one Logdisplay per key down ? What is going on
> please ? ( see attached image )
>
> 2. I get nothing for the Function key F10. I oresume these are being
> trapped somewhere else ?? How can I detect these ? ( I am not a great fan
> of SetKey())
>
> Some wisdom would be appreciated.
>
> Regards
>
> Chris Gillard
>
>
>
>
Responder