FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Trapping CTRL-T ?
Posts: 63
Joined: Mon Aug 02, 2010 05:38 PM
Trapping CTRL-T ?
Posted: Tue Sep 20, 2011 05:25 PM

I want to trap ctrl-t but I can't the key code in any of the tables. Where do I look to find the ctrl-t code?

Don

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Trapping CTRL-T ?
Posted: Tue Sep 20, 2011 05:33 PM

Don,

Maybe these notes from my files will help.

James


Alt key: Note that this is defined as VK_MENU in VKEY.CH (because this is the key that brings up the menu).

From: "Manuel Mercado" <mmercadog@prodigy.net.mx>
Subject: RE: How to control Ctrl+C and another similars shotcuts ?
Date: Thursday, October 04, 2001 3:39 AM

Hi Rimantas:

> In FW samples I found only on menu samples as keys accelerates .
> Please , help , how to control in dialog bKeyDown or bKeyChar
> shortcuts with Ctrl+ or Alt+ .

For Ctrl Key:

oObj:bKeydown := { | nKey | If( nKey == Asc( "C" ) .and. ;
GetKeyState( VK_CONTROL), ;
MyAction(), Nil ) }

For Alt Key:

oObj:bKeydown := { | nKey | If( nKey == Asc( "C" ) .and. ;
GetKeyState( VK_MENU ), ;
MyAction(), Nil ) }

Regards.

Manuel Mercado.
Salamanca, Gto., México.


From: "Enrico Maria Giordano" <e.m.giordano@emagsoftware.it>
Subject: Re: Alt key
Date: Friday, July 04, 2003 5:14 AM

Willy Hermans wrote:
>
> Is there no function that traps this key like the ctrl key.

GetKeyState() works perfectly for ALT key. Try this:

include "Fivewin.ch"

FUNCTION MAIN()

LOCAL oDlg

LOCAL oGet

LOCAL cVar := SPACE( 10 )

DEFINE DIALOG oDlg

@ 1, 1 GET oGet VAR cVar

oGet:bKeyDown = { | nKey | KeyHandle( nKey ) }

ACTIVATE DIALOG oDlg;
         CENTER

RETURN NIL

STATIC FUNCTION KEYHANDLE( nKey )

? GETKEYSTATE( VK_MENU )

RETURN NIL

Pressing CTRL alone you get .F. but pressing ALT and (keeping it
pressed) CTRL you get .T.. The problem is that, excluding CTRL, ALT+any
other key seems to not evaluate bKeyDown codeblock.

EMG


I suggested defining buttons with accellerator's, then hiding them.

...
From: "Michael Harris" <michael@perfectpointofsale.com>
Subject: Re: Alt key
Date: Friday, July 04, 2003 2:00 PM

I have tested the phantom button scheme (using their accelerators defined in
the PROMPT) suggested by James and Enrico and have got it working. It was
not necessary to :hide() them since I defined them @ 100,0 out of the
boundary of the little GET DIALOG in TCBROWSE. It was a bit tricky since a
code defined button is set as the default to be activated when ENTER so I
had to do a STYLE nor(WS_CHILD) so that my ENTER did not activate the
phantom buttons. So even though I can't trap ALT straight out, this is a
good workaround.
Thanks very much.
Michael

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion