FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Catch Alt+Key combinations
Posts: 14
Joined: Fri Mar 02, 2012 11:08 AM
Catch Alt+Key combinations
Posted: Thu Aug 30, 2012 10:05 PM

I have a Window with ButtonBar and XBrowse. No menu.

How can I perform some operations on Alt+<Key> shortcuts?
I need to do both Alt+<letter> and Alt+<F_key>

Thank you.

Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: Catch Alt+Key combinations
Posted: Fri Aug 31, 2012 11:08 AM
Use SetKey and inside de setkey function verify:

Code (fw): Select all Collapse
SetKey( VK_F2, {||Shortcut()} )

Procedure Shortcut()

   If GetKeyState(VK_SHIFT) // Shift
      ? "Shift+F2"
   end
   If GetKeyState(VK_CONTROL) // CTRL
      ? "Ctrl+F2"
   end
   If GetKeyState(VK_MENU) // Alt
      ? "Alt+F2"
   end

return
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 14
Joined: Fri Mar 02, 2012 11:08 AM
Re: Catch Alt+Key combinations
Posted: Fri Aug 31, 2012 07:57 PM
Code (fw): Select all Collapse
 ...
   If GetKeyState(VK_MENU) // Alt
      ? "Alt+F2"
   end
..


Doesn't work. It works fine for Ctrl+F2 and Shift+F2, but not for Alt.

Also I have some Alt+<Letter> shortcuts that should work on given window.
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Catch Alt+Key combinations
Posted: Sat Sep 01, 2012 01:25 PM

It does not appear that you can trap the <alt> key .. oDlg:bKeyDown seems to ignore returning a value for <alt> :( .. <ALT> key combinations are routed to Windows controls like <alt+f4> for a windows 'close'

I recommend changing your key routines to <shift>+key

Rick Lipkin

Continue the discussion