FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Why only VK_F?? keys can be redefined using SetKey()?
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Why only VK_F?? keys can be redefined using SetKey()?
Posted: Tue Sep 12, 2006 02:28 PM
This is a sample:

#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:

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


Is it intentional?

EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Why only VK_F?? keys can be redefined using SetKey()?
Posted: Tue Sep 12, 2006 04:35 PM

Enrico,

> Is it intentional?

It looks so :-)

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Why only VK_F?? keys can be redefined using SetKey()?
Posted: Tue Sep 12, 2006 04:46 PM
Antonio Linares wrote:Does Clipper allow to use SetKey() with any key ?


Yes:

#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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Why only VK_F?? keys can be redefined using SetKey()?
Posted: Tue Sep 12, 2006 04:52 PM

Enrico,

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

Thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Why only VK_F?? keys can be redefined using SetKey()?
Posted: Tue Sep 12, 2006 05:00 PM

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 ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Why only VK_F?? keys can be redefined using SetKey()?
Posted: Tue Sep 12, 2006 06:12 PM
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

Continue the discussion