home *** CD-ROM | disk | FTP | other *** search
- set scoreboard off
- colSTR = "+w/b,n/w,,,n/w"
- colCHC = "+gr/bg,+w/r,,,+n/bg"
- colCHCX = "n/bg"
-
- setcolor( colstr)
- clear
-
- var1 = space(3)
- var2 = space(1)
- var3 = space(3)
-
- @ 5, 0 say "Var1: " get var1 valid ( temp() )
- @ 6, 0 say "Var2: " get var2 when ( myUdf( @var2) )
- @ 7, 0 say "Var3: " get var3
-
- read
-
-
- *------------------------*
- function temp
- local oldgets
- static var4, var5
-
- oldgets := Getlist
-
- Getlist := {}
-
- if valtype( VAR4) != "C"
- var4 := space(5)
- endif
-
- if valtype( VAR5) != "C"
- var5 := space(5)
- endif
-
- @ 10, 40 say "Nested Gets:"
-
- @ 11, 40 say "Var4: " get var4
- @ 12, 40 say "Var5: " get var5
- read
-
- Getlist := oldgets
-
- return .t.
-
- *------------------------*
- function myUdf( tmpvar)
- local ans
-
- declare la_choices[3]
- la_choices[1] = "Choice 1"
- la_choices[2] = "Choice 2"
- la_choices[3] = "Choice 3"
-
- ans = ach_wndw( la_choices, " Select One ",,,, "achudf" )
-
- if ans != 0
- tmpvar := alltrim( str( ans))
- endif
-
- return .t.
-
- *------------------------*
- function AchUdf( status)
-
- local lastkey, ret_val
-
- lastkey := lastkey()
-
- do case
- case lastkey == 13 /* a selection has been made */
- keyboard chr(13)
- ret_val := 1 /* done with achoice */
- case status == 1 /* cursor past top of list */
- keyboard chr(5) /* stuff an up arrow to move to previous get */
- ret_val := 0 /* abort selection process */
- case lastkey == 27 /* ESC was pressed. Exit achoice */
- keyboard chr(13)
- ret_val := 0 /* abort selection process */
- otherwise
- ret_val := 2 /* continue selection process */
- endcase
-
- return ret_val
- *------------------------*
-
- FUNCTION Center( char, width, row, clr)
-
- LOCAL length, ret_val, oldcolor
-
- IF valtype(WIDTH) != "N"
- WIDTH = 80
- ENDIF
-
- length = LEN(char)
-
- ret_val = IF( length < WIDTH, (WIDTH - length)/2, 0 )
-
- * If the 3rd parameter was passed, then print to current device
- IF valtype(ROW) == "N"
-
-
- * If 4th parameter was passed, then use that color
- IF valtype(CLR) == "C"
- oldcolor = SETCOLOR(clr)
- ENDIF
-
- @ ROW, ret_val SAY char
-
- IF valtype(CLR) == "C"
- SETCOLOR(oldcolor)
- ENDIF
-
-
- ENDIF
-
- RETURN ret_val
- *---------------------------*
-
-
-