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 - <b>readvar()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 READVAR()
 Return the current GET/MENU variable name
------------------------------------------------------------------------------
 Syntax

     READVAR() --> cVarName

 Returns

     READVAR() returns the name of the variable associated with the current
     Get object or the variable being assigned by the current MENU TO command
     as an uppercase character string.

 Description

     READVAR() is an environment function that primarily implements context-
     sensitive help for Get objects and lightbar menus.  READVAR() only works
     during a READ or MENU TO command.  If used during any other wait states,
     such as ACCEPT, INPUT, WAIT, ACHOICE(), DBEDIT(), or MEMOEDIT(), it
     returns a null string ("").  Access it within a SET KEY procedure, or
     within a user-defined function invoked from a WHEN or VALID clause of a
     Get object.

 Examples

     .  This example implements a simple help system for Get objects
        using a database file to store the help text.  When the user presses
        F1, the help database file is searched using READVAR() as the key
        value.  If there is help text available, it is displayed in a window:

        #include "Inkey.ch"
        //
        SET KEY K_F1 TO HelpLookup
        cString = SPACE(10)
        @ 5, 5 SAY "Enter:" GET cString
        READ
        RETURN

        FUNCTION HelpLookup
           USE Help INDEX Help NEW
           SEEK READVAR()
           IF FOUND()
              DisplayHelp(Help->Topic)
           ELSE
              DisplayHelp("No help for " + READVAR())
           ENDIF
           CLOSE Help
           RETURN NIL

        FUNCTION DisplayHelp( cTopic )
           LOCAL cScreen := SAVESCREEN(5,5,15,70),;
                  cColor := SETCOLOR("BG+/B")
           //
           SET CURSOR OFF
           @ 5, 5 CLEAR TO 15, 70
           @ 5, 5 TO 15, 70 DOUBLE
           @ 5, 30 SAY " Help for " + READVAR() + " "
           MEMOEDIT(cTopic, 6, 7, 14, 68, .F.)
           //
           RESTSCREEN(5, 5, 15, 70, cScreen)
           SETCOLOR(cColor)
           SET CURSOR ON
           //
           RETURN NIL

 Files   Library is CLIPPER.LIB.


See Also: @...GET MENU TO READ SET KEY

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