FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posted: Mon Oct 31, 2022 04:50 AM
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 (fw): Select all Collapse
   :bKeyDown   := { |nKey| DoMyKey(nKey) }
so i wrote
Code (fw): Select all Collapse
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posted: Mon Oct 31, 2022 07:29 AM
Dear Jimmy,

Usually you associate Alt to a menuitem action that will be executed:
Code (fw): Select all Collapse
      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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posted: Mon Oct 31, 2022 07:32 AM
Pressing F1 you get this call by default (Class TWindow):
Code (fw): Select all Collapse
   // 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
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posted: Mon Oct 31, 2022 08:18 AM
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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posted: Mon Oct 31, 2022 08:43 AM
Jimmy wrote:why is GetKeyState( VK_MENU ) not recognize :?:
Try GetAsyncKeyState( VK_MENU ). Works fine here.
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posted: Mon Oct 31, 2022 05:14 PM

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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posted: Mon Oct 31, 2022 05:46 PM
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.
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posted: Mon Oct 31, 2022 05:56 PM

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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posted: Mon Oct 31, 2022 06:26 PM
Armando wrote:Enrico:

In my example

GetAsyncKey(VK_SHIFT,VK_TAB)

Works fine.
Please try with
Code (fw): Select all Collapse
GetAsyncKey(VK_SHIFT)
It should be the same.
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posted: Mon Oct 31, 2022 10:09 PM
hi Enrico,
Enrico Maria Giordano 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
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Fivewin Setkey(ALT + F2, {|| ...} ) ?
Posted: Mon Oct 31, 2022 10:16 PM
hi Antonio,
Antonio Linares wrote:Usually you associate Alt to a menuitem action that will be executed:
hm ... :idea:

Workaroud
Code (fw): Select all Collapse
   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

Continue the discussion