Page 1 of 1

Why only VK_F?? keys can be redefined using SetKey()?

Posted: Tue Sep 12, 2006 2:28 pm
by Enrico Maria Giordano
This is a sample:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL nVar := 0

    SETKEY( ASC( "-" ), { || MsgInfo( "Minus pressed" ) } )
    SETKEY( VK_F2, { || MsgInfo( "F2 pressed" ) } )

    DEFINE DIALOG oDlg

    @ 1, 1 GET nVar OF oDlg;
           PICTURE "99999";
           RIGHT

    @ 3, 1 BUTTON "&Close" OF oDlg ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL
And this is the cause:

Code: Select all

if bKeyAction != nil .and. lAnd( nFlags, 16777216 ) // function Key
Is it intentional?

EMG

Posted: Tue Sep 12, 2006 4:35 pm
by Antonio Linares
Enrico,

> Is it intentional?

It looks so :-)

Does Clipper allow to use SetKey() with any key ?

Posted: Tue Sep 12, 2006 4:46 pm
by Enrico Maria Giordano
Antonio Linares wrote:Does Clipper allow to use SetKey() with any key ?
Yes:

Code: Select all

#include "Inkey.ch"


FUNCTION MAIN()

    LOCAL GetList := {}

    LOCAL nVar := 0

    CLS

    SETKEY( ASC( "-" ), { || QOut( "Minus pressed" ) } )
    SETKEY( K_F2, { || QOut( "F2 pressed" ) } )

    @ 1, 1 GET nVar PICTURE "99999"

    READ

    INKEY( 0 )

    RETURN NIL
EMG

Posted: Tue Sep 12, 2006 4:52 pm
by Antonio Linares
Enrico,

Then we should remove ".and. lAnd( nFlags, 16777216 )"

Thanks!

Posted: Tue Sep 12, 2006 5:00 pm
by Antonio Linares
Enrico,

Lets wait a moment... we used that code because function keys provide chars values like standard keys (non function).

If we remove that code, how will we distinct them ?

Posted: Tue Sep 12, 2006 6:12 pm
by Enrico Maria Giordano
Antonio Linares wrote:Enrico,

Lets wait a moment... we used that code because function keys provide chars values like standard keys (non function).

If we remove that code, how will we distinct them ?
I don't know, sorry. Let's keep it unchanged till we'll found a solution.

EMG