[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   FunctionCalls via Setkey():

   Using Clipper's Setkey() you can combine your own functions
   with Menus.

   ( The description is entered in aPop-MenuArray, see PopMenu() )

   Each key pressed will be checked for a possible Setkey()-statement.
   If the key is defined, your function will be called:

          CASE (bAction := SETKEY( nKey )) != NIL
               lReturn  := EVAL(bAction)

   Using the ReturnValue of your own function, you can steer the
   following actions, as long as you're still in BarMenu
   ( Meaning: no PopUp-MenuWindow is opened )

   If TRUE is returned -> the menu will be canceled. Any other type
   of ReturnValue ( or FALSE ) brings you back to the Menu and you'll
   stay there.

   Didn't get that one ? Don't worry :

   EXAMPLE:

   Have a look at the following source :

         procedure Test
          .
          .  [ stuff deleted ]
          .
         setkey(K_F1,{||Help()}
         setkey(K_F2,{||Skip()}

         do while ... something

            BarMen (1, 1, 1, , aTest, aMouse)
             .
             show data
             .
            case..
            case ..
            endcase
         enddo

         function skip()
           skip
         return(.t.)

         function help()
           show_help_text
         return(.f.)       // oder 'stupid' oder 43255 oder whatever...
                                  anything but .T.

   What happens ?
   The programm stops at BarMen() and waits until you press a key.
   If you press F2 now, Function SKIP() will be called and .T.  will
   be returned to BarMen(). BarMen() recognizes this .T. and the
   Menu is canceled. Next step is 'show data'.
   As we're in a loop, BarMen() is called again and waits for a key
   to be pressed.

   If you press the F1 key instead of F2, the HELP() Function is called,
   some ( more or less ) helpful text will be displayed and the function
   will return .F. to BarMen(). BarMen() receives the .F. and therefore
   will remain active. The Menu is not cancelled !

   Clear ? clear.






This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson