Página 1 de 1

OnKeyDown Event ....

Publicado: Mar Feb 26, 2008 6:32 pm
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

OnKeyDown Event ....

Publicado: Mié Feb 27, 2008 9:47 pm
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
>
>
>
>

OnKeyDown Event ....

Publicado: Mié Feb 27, 2008 9:47 pm
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
>
>
>
>