home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a065 / 1.img / TBPRGS.EXE / TB07.PRG < prev    next >
Encoding:
Text File  |  1992-03-10  |  1.1 KB  |  37 lines

  1.     // Tb07.prg
  2.     //
  3.     // Standard generic browse routine, MyBrowse2. Allows key specific
  4.     // actions to be passed as key / block pairs
  5.     //
  6.     // Compile with /a /m /n /w
  7.  
  8.     #include "Inkey.ch"
  9.  
  10.     FUNCTION MyBrowse2(oTbr, aBeforepairs, aAfterPairs)
  11.  
  12.     LOCAL nKey
  13.     LOCAL lExitRequested := .F.
  14.     LOCAL nElem
  15.  
  16.       // set defaults for before and after keys
  17.       aBeforePairs := iif(aBeforePairs == NIL, {}, aBeforePairs)
  18.       aAfterpairs  := iif(aAfterPairs  == NIL, {}, aAfterPairs)
  19.  
  20.       DO WHILE !lExitRequested
  21.         FullStabilize(oTbr)
  22.         nKey := InKey(0)
  23.         nElem := Ascan(aBeforePairs, ;
  24.                        {|e| e[1] == nKey })
  25.         IF nElem > 0
  26.           lExitRequested := Eval(aBeforePairs[nElem, 2], oTbr)
  27.         ELSEIF !StdMeth(nKey, oTbr) .AND. oTbr:stable
  28.           nElem := Ascan(aAfterPairs, ;
  29.                          {|e| e[1] == nKey })
  30.           lExitRequested := iif(nElem > 0, ;
  31.                                 Eval(aAfterPairs[nElem, 2], oTbr), ;
  32.                                 nKey == K_ESC)
  33.         ENDIF
  34.       ENDDO
  35.  
  36.     RETURN NIL
  37.