Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

     applyKey(<nKey>) --> nResult

        Evaluates the code block associated with <nKey> that is contained
        within the TBrowse:setKey() dictionary.  <nResult>, which is the code
        block's return value, specifies the manner in which the key was
        processed.

        TBrowse:ApplyKey() Return Values
        ---------------------------------------------------------------------
        Constant      Value   Meaning
        ---------------------------------------------------------------------
        TBR_EXIT      -1      User request for the browse to lose input focus
        TBR_CONTINUE   0      Code block associated with <nKey> was evaluated
        TBR_EXCEPTION  1      Unable to locate <nKey> in the dictionary, key
                              was not processed
        ---------------------------------------------------------------------

        Tbrowse.ch contains manifest constants for the TBrowse:applyKey()
        return values.

        Previously, before TBrowse:applyKey() was available, a TBrowse was
        typically maintained by placing an Inkey() and a case structure
        within a while loop.  For example:

        WHILE (.T.)
           oTB:ForceStable()
           nKey := Inkey(0)
           DO CASE
           CASE (nKey == K_UP)
              oTB:Up()
           CASE (nKey == K_DOWN)
              oTB:Down()
           .
           .
           .
           CASE (nKey := K_ESC)
              EXIT
           ENDCASE
        ENDDO

        Because this code was external to the browse, it did not encapsulate
        the relationship between a key press and its effect on the browse.
        TBrowse:applyKey() resolves this by placing the key and its
        associated code block in a dictionary within the TBrowse object.
        This effectively makes creating and managing a browse simple, yet
        flexible.  For example:

        WHILE (.T.)
           oTB:ForceStable()
           IF (oTB:ApplyKey(Inkey(0)) == TBR_EXIT)
              EXIT
           ENDIF
        ENDDO

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