Page 1 of 1

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

Posted: Mon Oct 31, 2022 4:50 am
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 :?:

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

Posted: Mon Oct 31, 2022 7:29 am
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" )

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

Posted: Mon Oct 31, 2022 7:32 am
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()

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

Posted: Mon Oct 31, 2022 8:18 am
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 :?:

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

Posted: Mon Oct 31, 2022 8:43 am
by Enrico Maria Giordano
Jimmy wrote:why is GetKeyState( VK_MENU ) not recognize :?:
Try GetAsyncKeyState( VK_MENU ). Works fine here.

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

Posted: Mon Oct 31, 2022 5:14 pm
by Armando
Jimmy:

Here is an other sample

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

Regards

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

Posted: Mon Oct 31, 2022 5:46 pm
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.

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

Posted: Mon Oct 31, 2022 5:56 pm
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

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

Posted: Mon Oct 31, 2022 6:26 pm
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.

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

Posted: Mon Oct 31, 2022 10:09 pm
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 )

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

Posted: Mon Oct 31, 2022 10:16 pm
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