FUNCTIONS CORE

SetKeySave()

Return all SetKey() assignments and optionally replace them

Syntax

Signature
SetKeySave( [aNewKeys] ) --> aOldKeys

Arguments

aNewKeys

An array from SetKeySave() or SaveSetKey(). It takes the place of all assignments. NIL releases all keys. Without the argument nothing changes.

Return value

The assignments before the call: { nKey, bAction, bCondition | NIL } for each key.

Description

SetKeySave() saves and replaces the keys in one call:

aOld := SetKeySave( NIL ) // all keys free for a dialog ... SetKeySave( aOld ) // the keys of before

Notes

An array of another form changes nothing.

Example

SetKeySave.prg
#include "inkey.ch"

PROCEDURE Main()

   LOCAL aOld

   SetKey( K_F2, {|| "save" } )
   aOld := SetKeySave( NIL )

   Check( 'SetKeySave() returns one key     ', Len( aOld ), 1 )
   Check( 'NIL released all keys            ', SetKey( K_F2 ), NIL )

   SetKeySave( aOld )
   Check( 'the array restored the key       ', Eval( SetKey( K_F2 ) ), "save" )

RETURN

STATIC PROCEDURE Check( cTitle, xResult, xExpected )

   QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )

RETURN

Output

SetKeySave() returns one key     OK
NIL released all keys            OK
the array restored the key       OK

See also