home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / clarion / brokcode.zip / MEMOEDIT.EXE / MEMO3.CLA < prev    next >
Text File  |  1991-12-05  |  4KB  |  101 lines

  1.          MEMBER('MEMO')
  2. UPD_MEMOTEST PROCEDURE
  3.  
  4. SCREEN         SCREEN      WINDOW(24,80),PRE(SCR),HUE(15,1)
  5.            ROW(1,1)      STRING('┌─{78}┐')
  6.            ROW(2,1)      REPEAT(22);STRING('│<0{78}>│') .
  7.            ROW(24,1)  STRING('└─{78}┘')
  8.            ROW(8,3)      STRING('Comments'),HUE(11,1)
  9.          COL(12)  STRING('(Press <<'),HUE(11,1)
  10.          COL(20)  STRING('F1'),HUE(14,1)
  11. MESSAGE           ROW(3,26)  STRING(30),HUE(0,3)
  12.          COL(56)  ENTRY,USE(?FIRST_FIELD)
  13.            ROW(5,11)  STRING('Name '),HUE(11,1)
  14.          COL(16)  ENTRY(@S30),USE(FIL:Name),HUE(15,1),SEL(14,4),REQ
  15.            ROW(6,4)      STRING('Description '),HUE(11,1)
  16.          COL(16)  ENTRY(@S50),USE(FIL:Descript),HUE(15,1),SEL(14,4)
  17.            ROW(8,22)  STRING('> for Editor Help) '),HUE(11,1)
  18.          COL(41)  ENTRY(@P*P),USE(MEM:DummyField),HUE(15,1)
  19.               REPEAT(15),INDEX(RepNdx)
  20. MemoLine       ROW(9,3)        STRING(76),HUE(15,1)
  21.               .
  22.          COL(79)  ENTRY,USE(?LAST_FIELD)
  23.          COL(79)  PAUSE(''),USE(?DELETE_FIELD)
  24.          .
  25.  
  26. RepNdx         BYTE                 ! Repeat index
  27.  
  28.   EJECT
  29.   CODE
  30.   OPEN(SCREEN)                     !OPEN THE SCREEN
  31.   SETCURSOR                     !TURN OFF ANY CURSOR
  32.   DISPLAY                     !DISPLAY THE FIELDS
  33.   LOOP RepNdx = 1 TO 15                 !Display the memo field
  34.     SCR:MemoLine = Fil_Memo_Row[RepNdx]         !
  35.   .                         !
  36.   LOOP                         !LOOP THRU ALL THE FIELDS
  37.     MEM:MESSAGE = CENTER(MEM:MESSAGE,SIZE(MEM:MESSAGE)) !DISPLAY ACTION MESSAGE
  38.     DO CALCFIELDS                 !CALCULATE DISPLAY FIELDS
  39.     ALERT                     !RESET ALERTED KEYS
  40.     ALERT(ACCEPT_KEY)                 !ALERT SCREEN ACCEPT KEY
  41.     ALERT(REJECT_KEY)                 !ALERT SCREEN REJECT KEY
  42.     ACCEPT                     !READ A FIELD
  43.     IF KEYCODE() = REJECT_KEY THEN RETURN.     !RETURN ON SCREEN REJECT KEY
  44.     EXECUTE ACTION                 !SET MESSAGE
  45.       MEM:MESSAGE = 'Record will be Added'     !
  46.       MEM:MESSAGE = 'Record will be Changed'     !
  47.       MEM:MESSAGE = 'Press Enter to Delete'     !
  48.     .
  49.     IF KEYCODE() = ACCEPT_KEY             !ON SCREEN ACCEPT KEY
  50.       UPDATE                     !  MOVE ALL FIELDS FROM SCREEN
  51.       SELECT(?)                     !  START WITH CURRENT FIELD
  52.       SELECT                     !  EDIT ALL FIELDS
  53.       CYCLE                     !  GO TO TOP OF LOOP
  54.     .
  55.     CASE FIELD()                 !JUMP TO FIELD EDIT ROUTINE
  56.     OF ?FIRST_FIELD                 !FROM THE FIRST FIELD
  57.       IF KEYCODE() = ESC_KEY THEN RETURN.     !  RETURN ON ESC KEY
  58.       IF ACTION = 3 THEN SELECT(?DELETE_FIELD).!    OR CONFIRM FOR DELETE
  59.  
  60.     OF ?FIL:Name
  61.       IF DUPLICATE(FIL:BY_Name)             !  CHECK FOR DUPLICATE KEY
  62.     MEM:MESSAGE = 'CREATES DUPLICATE ENTRY'     !    MOVE AN ERROR MESSAGE
  63.     SELECT(?FIL:Name)             !    STAY ON THE SAME FIELD
  64.     BEEP                     !    SOUND THE KEYBOARD ALARM
  65.     CYCLE                     !    AND LOOP AGAIN
  66.       .
  67.  
  68.     OF ?MEM:DummyField                 ! Edit the memo field
  69.       Junk# = MemoEdit(Fil_Memo_Row[],SCR:MemoLine,RepNdx,15)
  70.  
  71.     OF ?LAST_FIELD                 !FROM THE LAST FIELD
  72.       EXECUTE ACTION                 !  UPDATE THE FILE
  73.     ADD(MEMOTEST)                 !    ADD NEW RECORD
  74.     PUT(MEMOTEST)                 !    CHANGE EXISTING RECORD
  75.     DELETE(MEMOTEST)             !    DELETE EXISTING RECORD
  76.       .
  77.       IF ERRORCODE() = 40             !  DUPLICATE KEY ERROR
  78.     MEM:MESSAGE = ERROR()             !    DISPLAY ERR MESSAGE
  79.     SELECT(2)                 !    POSITION TO TOP OF FORM
  80.     CYCLE                     !    GET OUT OF EDIT LOOP
  81.       ELSIF ERROR()                 !  CHECK FOR UNEXPECTED ERROR
  82.     STOP(ERROR())                 !    HALT EXECUTION
  83.       .
  84.       ACTION = 0                 !  SET ACTION TO COMPLETE
  85.       RETURN                     !  AND RETURN TO CALLER
  86.  
  87.     OF ?DELETE_FIELD                 !FROM THE DELETE FIELD
  88.       IF KEYCODE() = ENTER_KEY |         !  ON ENTER KEY
  89.       OR KEYCODE() = ACCEPT_KEY             !  OR CTRL-ENTER KEY
  90.     SELECT(?LAST_FIELD)             !    DELETE THE RECORD
  91.       ELSE                     !  OTHERWISE
  92.     BEEP                     !    BEEP AND ASK AGAIN
  93.   . . .
  94.  
  95. CALCFIELDS   ROUTINE
  96.   IF FIELD() > ?FIRST_FIELD             !BEYOND FIRST_FIELD?
  97.     IF KEYCODE() = 0 AND SELECTED() > FIELD() THEN EXIT. !GET OUT IF NOT NONSTOP
  98.   .
  99.   SCR:MESSAGE = MEM:MESSAGE
  100.  
  101.