home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 6.14 STATIC Functions and ACHOICE()
- Author: Greg Lief
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
- //───── NOTE: must compile with the /N option!
-
- #include "inkey.ch"
-
- function main
- local marray := {'one', 'two', 'three'}, ele
- cls
- ele := achoice(11, 38, 13, 42, marray, .t., 'MyFunc')
- return nil
-
- //───── this function will not be recognized until you remove
- //───── the STATIC declaration
- static function myfunc(status, curr_elem, curr_row)
- local key := lastkey()
- if key == K_ESC
- return 0
- elseif key == K_ENTER
- return 1
- elseif key == 32
- @ 20,0 say "You pressed Spacebar! Boy am I smart!"
- inkey(0)
- scroll(20, 0, 20, 36, 0)
- endif
- return 2
-
- // end of file CHP0614.PRG
-