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

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