home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / memoge.zip / MGDEMO.PRG < prev   
Text File  |  1993-08-02  |  2KB  |  83 lines

  1. // MGDemo.prg
  2. //
  3. // Demo of MemoGet
  4. //
  5. // Compile: Clipper MGDEMO /n/m/w/l
  6. // Link   : file MGDEMO, MEMOGET
  7. //
  8. // Compile with /DVARINIT to initialize GET variables to something other
  9. // than blanks
  10.  
  11. #include "box.ch"
  12. #include "memoget.ch"
  13.  
  14. procedure main()
  15.     local cName, nAge, cNotes, cAddr, cHistory, getList := {}
  16.  
  17.     set scoreboard off
  18.     set confirm on
  19.  
  20.     #ifdef VARINIT
  21.         cName    := padr("Shaun Botha", 25)
  22.         nAge     := 27
  23.         cAddr    := padr("Princeton, NJ", 25)
  24.         cNotes   := "- Hope you enjoy this." + chr(13) + chr(10)+;
  25.                     "- What else can be added ?" + chr(13) + chr(10) +;
  26.                     "- Where on earth is VOC ???"
  27.         cHistory := "7/30/93: Germ of an idea" + chr(13) + chr(10) +;
  28.                     "7/31/93: Programmed"
  29.     #else
  30.         cName    := space(25)
  31.         nAge     := 0
  32.         cAddr    := space(25)
  33.         cNotes   := ""
  34.         cHistory := ""
  35.     #endif
  36.  
  37.     clear screen
  38.  
  39.     // Here we are 'GET'ting 2 memo fields - one uses the default memo editor,
  40.     // the other a custom editor defined in this file.  You must specify
  41.     // editor coordinates for the editors to use.  Although it could probably
  42.     // be done without it does provide a standard interface.  I've used
  43.     // the current row and column for both editors' top-left coordinates but
  44.     // one can use any legal coordinates.
  45.  
  46.     @ 0, 0 say "Name   :" get cName
  47.     @ 1, 0 say "Age    :" get nAge picture "99"
  48.     @ 2, 0 say "Notes  :" get cNotes as memo;
  49.         row(), col(), 20, 50
  50.     @ 3, 0 say "Address:" get cAddr
  51.     @ 4, 0 say "History:" get cHistory as memo;
  52.         row(), col(), 15, 65;
  53.         editor myEditor
  54.     read
  55.  
  56.     clear screen
  57. return
  58.  
  59.  
  60. // Custom editor
  61. function myEditor(cMemo,t,l,b,r)
  62.     local s
  63.     local row, col, clr, curs
  64.  
  65.     // Save screen environment
  66.     s := saveScreen(t,l,b,r)
  67.     row := row()
  68.     col := col()
  69.     clr := setColor()
  70.     curs := setCursor()
  71.  
  72.     @ t,l,b,r box B_SINGLE + " "
  73.     @ t,l+1 say "History Editor"
  74.     setColor("n/w")
  75.     cMemo := memoEdit(cMemo, t+1, l+1, b-1, r-1)
  76.  
  77.     // Restore screen environment
  78.     setPos(row, col)
  79.     setColor(clr)
  80.     setCursor(curs)
  81.     restScreen(t,l,b,r, s)
  82. return cMemo
  83.