Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Nanforum Toolkit v2.1 Reference Guide - <b>ft_setkeys()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FT_SETKEYS()
 Get array of keys redirected via the SetKey() or SET KEY
------------------------------------------------------------------------------

 Syntax

     FT_SetKeys() --> aKeyValues

 Arguments

    None

 Returns

    An array from 0 to n elements, where n is the number of keys that
    have been redirected via SetKey().  Each element in the array contains
    the Inkey() value of a key that has been redirected.

 Description

    Nantucket encourages Clipper programmers to write modular code -- black
    boxes that do not modify any global settings without resetting them
    on exit.  In the past, this has proven cumbersome where SetKey() is
    concerned, because the only way to see if a key had been redirected
    was to call SetKey() and see if it returned NIL or a code block.  To
    check every possible key value was unacceptably slow.

    This function attempts to alleviate this problem by returning an array
    that contains only those keys that have been redirected.  It is
    substantially faster than the method mentioned above because it
    directly accesses Clipper's internal table of redirected keys.

    Some highly unorthodox programming techniques, not to mention rather
    strange use of Clipper internals, was necessary to make this function
    work.  If this makes you uncomfortable, then don't use this function,
    you snivelling coward.

 Examples

    local aKeys := FT_SetKeys()    // Get the key table
    local aBlox := {}              // Create a parallel array
    local i

    for i := 1 to len( aKeys )
      // Nullify all redirections, while saving code block
      // for later restoration

      aadd( aBlox, setkey( aKeys[ i ], NIL )
    next

    // Do some stuff

    for i := 1 to len( aKeys )
      // Restore the redirections

      setkey( aKeys[ i ], aBlox[ i ] )
    next

 Source: SETKEYS.ASM

 Author: Ted Means

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson