xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_SetKeySave()

Queries or changes all SetKey() code blocks.

Syntax

HB_SetKeySave( [<aNewKeyBlock>] ) --> aOldKeyBlock

Arguments

<aNewKeyBlock>
This is an optional two dimensional array with three columns. Each array element is an array holding three values. They are used as parameters for the SetKey() function. If <aNewKeyBlock> is an array, new key/code block associations are defined.

When NIL is explicitly passed for <aNewKeyBlock>, all active SetKey() code blocks are voided.

Return

The function returns a two dimensional array holding the previous key/code block associations.

Description

HB_SetKeySave() queries all active key/code block associations defined with the SetKey() function. Optionally, new SetKey() code blocks can be defined with <aNewKeyBlock> or they can be voided when NIL is passed to the function.

When the return value is passed to HB_SetKeySave(), all previously defined SetKey() code blocks become active again.

Info

See also:Inkey(), RestSetkey(), SaveSetkey(), SetKey()
Category: Environment functions , Keyboard functions , xHarbour extensions
Source:rtl\setkey.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example defines SetKey() code blocks which branch to
// sub-routines while READ is executed. To suppress recursive
// calls within sub-routines, all key/code block associations
// are voided and restored with HB_SetKeySave().

   #include "Inkey.ch"

   PROCEDURE Main
      LOCAL cString := "Testing HB_SetKeySave()"

      CLS
      SET KEY K_F2 TO F2_Key
      SET KEY K_F3 TO F3_Key

      @ 10,10 SAY "Press F1, F2 or F3" GET cString
      READ

   RETURN


   PROCEDURE Help( cProcName, nProcLine, cReadVar )
      LOCAL cScreen := SaveScreen()
      LOCAL aSaved  := HB_SetKeySave( NIL ) // no recursive calls
      CLS
      ? "Help routine"
      ? "Called from:", cProcName, nProcLine, cReadVar
      WAIT
      HB_SetKeySave( aSaved )
      Restscreen(,,,, cScreen )
   RETURN


   PROCEDURE F2_Key( cProcName, nProcLine, cReadVar )
      LOCAL cScreen := SaveScreen()
      LOCAL aSaved  := HB_SetKeySave( NIL ) // no recursive calls
      CLS
      ? "F2 key pressed"
      ? "Called from:", cProcName, nProcLine, cReadVar
      WAIT
      HB_SetKeySave( aSaved )
      Restscreen(,,,, cScreen )
   RETURN


   PROCEDURE F3_Key( cProcName, nProcLine, cReadVar )
      LOCAL cScreen := SaveScreen()
      LOCAL aSaved  := HB_SetKeySave( NIL ) // no recursive calls
      CLS
      ? "F3 key pressed"
      ? "Called from:", cProcName, nProcLine, cReadVar
      WAIT
      HB_SetKeySave( aSaved )
      Restscreen(,,,, cScreen )
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe