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

  1.     // Tb04.prg
  2.     //
  3.     // Simple database browse with added cosmetics
  4.     // Rewrite of Tb02 to use StdMeth instead of large CASE statement.
  5.     // Compile with /a /m /n /w
  6.     // Link with Tbtils.obj for StdMeth, and Dict.obj
  7.  
  8.     #include "Inkey.ch"
  9.     #include "Tbutils.ch"    // for DEF_... separator characters
  10.  
  11.     FUNCTION Tb04
  12.  
  13.     FIELD Lname, Fname, Addr1, Addr2, Addr3, Addr4 IN TbDbf1
  14.  
  15.     LOCAL oTbr  := TBrowseDb(1, 1, MaxRow() - 1, MaxCol() - 1)
  16.     LOCAL oTbc1 := TBColumnNew("Last name",  {|| Lname })
  17.     LOCAL oTbc2 := TBColumnNew("First name", {|| Fname })
  18.     LOCAL oTbc3 := TBColumnNew("Address 1",  {|| Addr1 })
  19.     LOCAL oTbc4 := TBColumnNew("Address 2",  {|| Addr2 })
  20.     LOCAL oTbc5 := TBColumnNew("Address 3",  {|| Addr3 })
  21.     LOCAL oTbc6 := TBColumnNew("Address 4",  {|| Addr4 })
  22.     LOCAL nKey
  23.     LOCAL lExitRequested
  24.  
  25.       oTbr:colSep  := DEF_CSEP
  26.       oTbr:headSep := DEF_HSEP
  27.       oTbr:footSep := DEF_FSEP
  28.  
  29.       CLEAR SCREEN
  30.       @ 0, 0 TO MaxRow(), MaxCol()
  31.  
  32.       USE TbDbf1
  33.  
  34.       oTbr:addColumn(oTbc1)
  35.       oTbr:addColumn(oTbc2)
  36.       oTbr:addColumn(oTbc3)
  37.       oTbr:addColumn(oTbc4)
  38.       oTbr:addColumn(oTbc5)
  39.       oTbr:addColumn(oTbc6)
  40.  
  41.       lExitRequested := .F.
  42.       DO WHILE !lExitRequested
  43.         DO WHILE !oTbr:stabilize()
  44.         ENDDO
  45.         nKey := InKey(0)
  46.         IF !StdMeth(nKey, oTbr)
  47.           // Check here for other keys ...
  48.           DO CASE
  49.             CASE nKey == K_ESC
  50.               lExitRequested := .T.
  51.           ENDCASE
  52.         ENDIF
  53.       ENDDO
  54.  
  55.     RETURN NIL
  56.