Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post Reply
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post by Jimmy »

hi,

how do i use ALT + F2 as "Key" to call a ACTION :?:

---

i found in Help File
ON KEYDOWN
but search under \Sample there is no File use it :shock:

when search for KEYDOWN only i found

Code: Select all | Expand

   :bKeyDown   := { |nKey| DoMyKey(nKey) }
so i wrote

Code: Select all | Expand

STATIC PROCEDURE DoMyKey(nKey,nFlag,cWho)

   DO CASE
      CASE EMPTY(nKey)

      CASE nKey = VK_F1
         DO CASE
            CASE GetKeyState( VK_MENU ) ;                MsginFo("VK_MENU VK_F1",cWho)
            CASE GetKeyState( VK_CONTROL ) ;             MsginFo("VK_CONTROL VK_F1",cWho)
            CASE GetKeyState( VK_SHIFT ) ;               MsginFo("VK_SHIFT VK_F1",cWho)
         OTHERWISE
            ShowHelp()
         ENDCASE

      CASE nKey = VK_F2
         DO CASE
            CASE GetKeyState( VK_MENU ) ;                MsginFo("VK_MENU VK_F2",cWho)
            CASE GetKeyState( VK_CONTROL ) ;             MsginFo("VK_CONTROL VK_F2",cWho)
            CASE GetKeyState( VK_SHIFT ) ;               MsginFo("VK_SHIFT VK_F2",cWho)
         OTHERWISE
            MsginFo("VK_F2",cWho)
         ENDCASE
   ENDCASE

RETURN
when press ALT F2 nothing happens
when press CTRL + F2 i got MsgInfo()
when press SHIFT + F2 i got MsgInfo()
otherwise F2 i got MsgInfo()
when press ALT + F1 nothing happens
when press CTRL + F1 got Error Message no define
when press SHIFT + F1 got Error Message no define
otherwise F1 got Error Message no define
Question :
how to het ALT + nKey working :?:
what about "override" F1 :?:
greeting,
Jimmy
User avatar
Antonio Linares
Site Admin
Posts: 42594
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 38 times
Been thanked: 86 times
Contact:

Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post by Antonio Linares »

Dear Jimmy,

Usually you associate Alt to a menuitem action that will be executed:

Code: Select all | Expand

      MENUITEM FWString( "Save &as..." ) + Chr( 9 ) + "Alt+A" ;
         MESSAGE FWString( "Saves the active file under a new name" ) ;
         ACCELERATOR ACC_ALT, Asc( "A" )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42594
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 38 times
Been thanked: 86 times
Contact:

Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post by Antonio Linares »

Pressing F1 you get this call by default (Class TWindow):

Code: Select all | Expand

   // Generated by pressing F1 on an open Menu

   METHOD Help() INLINE ::HelpTopic()
So all you need is to redefine the Method Help()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post by Jimmy »

hi Antonio,

thx for Answer

do you know "Total Commander" ( Norton Commander )
ALT + F1 left Drive Select Combobox
ALT + F2 right Drive Select Combobox
---

to use SHIFT, CONTROL and ALT i can build 4 x 12 Fn-Key
how under Fivewin :?:

---

does F1 "only" work with "Help" :?:
why is GetKeyState( VK_MENU ) not recognize :?:
greeting,
Jimmy
User avatar
Enrico Maria Giordano
Posts: 8761
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 5 times
Contact:

Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post by Enrico Maria Giordano »

Jimmy wrote:why is GetKeyState( VK_MENU ) not recognize :?:
Try GetAsyncKeyState( VK_MENU ). Works fine here.
User avatar
Armando
Posts: 3275
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Been thanked: 2 times
Contact:

Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post by Armando »

Jimmy:

Here is an other sample

IF GetAsyncKey(VK_UP) .OR.;
GetAsyncKey(VK_SHIFT,VK_TAB)
RETURN (.T.)
ENDIF

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Enrico Maria Giordano
Posts: 8761
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 5 times
Contact:

Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post by Enrico Maria Giordano »

Armando wrote:Jimmy:

Here is an other sample

IF GetAsyncKey(VK_UP) .OR.;
GetAsyncKey(VK_SHIFT,VK_TAB)
RETURN (.T.)
ENDIF

Regards
GetAsyncKey() takes only one argument.
User avatar
Armando
Posts: 3275
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Been thanked: 2 times
Contact:

Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post by Armando »

Enrico:

In my example

GetAsyncKey(VK_SHIFT,VK_TAB)

Works fine.

If I push the TAB key only, the focus jumps to the next GET, but
If I push both keys, VK_SHIFT + VK_TAB, the focus jumps to the previous GET.

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Enrico Maria Giordano
Posts: 8761
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 5 times
Contact:

Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post by Enrico Maria Giordano »

Armando wrote:Enrico:

In my example

GetAsyncKey(VK_SHIFT,VK_TAB)

Works fine.
Please try with

Code: Select all | Expand

GetAsyncKey(VK_SHIFT)
It should be the same.
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post by Jimmy »

hi Enrico,
Enrico Maria Giordano wrote:
Jimmy wrote:why is GetKeyState( VK_MENU ) not recognize :?:
Try GetAsyncKeyState( VK_MENU ). Works fine here.
still can not get any Result for VK_MENU :(

i got Result for GetKeyState( VK_CONTROL ) and GetKeyState( VK_SHIFT ) but not for GetKeyState( VK_MENU )
greeting,
Jimmy
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?

Post by Jimmy »

hi Antonio,
Antonio Linares wrote:Usually you associate Alt to a menuitem action that will be executed:
hm ... :idea:

Workaroud

Code: Select all | Expand

   MENUITEM "Left"  + Chr(9) + "Alt+F1" ;
    ACCELERATOR ACC_ALT, 65648 ;
    ACTION MsgInfo("Alt+F1")

   MENUITEM "Right" + Chr(9) + "Alt+F2" ;
    ACCELERATOR ACC_ALT, 65649 ;
    ACTION MsgInfo("Alt+F2")
so i got now all ALT "Hotkey" also in MENU :D
greeting,
Jimmy
Post Reply