home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / dtx9303 / clarion / txinhalt.cla < prev    next >
Encoding:
Text File  |  1993-06-01  |  7.5 KB  |  174 lines

  1.                 TITLE('TOOLBOX')
  2. OMIT('╝')
  3. ╔════════════════════════════════════════════════════════════════════════════╗
  4. ║  Program - TOOLBOX                             !                           ║
  5. ║  Author  - Axel Fenger                         !                           ║
  6. ╚════════════════════════════════════════════════════════════════════════════╝
  7.                  PROGRAM
  8.  
  9.                  INCLUDE('KEYCODES.EQU')
  10.                  INCLUDE('CLARION.EQU')
  11.                  INCLUDE('ERRORS.EQU')
  12.  
  13.                  MAP
  14.                    CheckOpen(*FILE)
  15.                    DiskError(<STRING>),BYTE
  16.                    ShowWarning
  17.                    MODULE('TOOLBO01')
  18.                      HauptMenu 
  19.                      BearbeiteTxInhalt 
  20.                      BuildKeys 
  21.                      ZeigTxInhalt 
  22.                      DruckTxInhalt 
  23.                      RedirectReport 
  24.                      ViewReport 
  25.                    END
  26.                    INCLUDE('BROWSE.INC')
  27.                  END
  28.  
  29.                  EJECT('File Layouts')
  30.  
  31. GLO:MessageGroup GROUP
  32. GLO:Message1       STRING(45)
  33. GLO:Message2       STRING(45)
  34. GLO:Message3       STRING(45)
  35.                  .
  36. GLO:InsertMsg    STRING('Datensatz wird angehangen {65511}')
  37. GLO:ChangeMsg    STRING('Datensatz wird geändert {6}')
  38. GLO:DeleteMsg    STRING('OK für Löschen wählen {8}')
  39. GLO:Filespec     STRING(64)
  40.  
  41. TxInhalt         FILE,PRE(TxI),DRIVER('dBase3'),CREATE
  42. TxIndexKey         KEY(+TxI:TxIndex),OPT,NOCASE
  43. NameKey            KEY(+TxI:Name,+TxI:Vorname),DUP,NOCASE
  44. RECORD             RECORD
  45. TxIndex              STRING(14)
  46. Titel                STRING(74)
  47. UTitel               STRING(74)
  48. Rubrik               STRING(30)
  49. Ausgabe              STRING(10)
  50. Seite                STRING(3)
  51. Name                 STRING(30)
  52. Vorname              STRING(30)
  53. Sprache              STRING(30)
  54. Thema                STRING(30)
  55. Bemerkung            STRING(74)
  56.                  . .
  57.  
  58.  
  59. AddRecord        EQUATE(1)                       !  Add a new record
  60. ChangeRecord     EQUATE(2)                       !  Change the current record
  61. DeleteRecord     EQUATE(3)                       !  Delete the current record
  62.  
  63.  
  64.   CODE
  65.   LOADSYMBOLS                                    !Display graphic mouse
  66.   SETNOBLINK                                     !Enable enhanced colors
  67.   SETMOUSE(1,1)                                  !Turn on mouse
  68.   SETCOLOR(WhiteOnBlack)                         !Set white on black
  69.   BLANK                                          !Clear the screen
  70.   SETCOLOR                                       !Turn off override color
  71.  
  72.   HauptMenu                                      !Call the first procedure
  73.  
  74.   RETURN                                         !Return to DOS
  75.  
  76. OMIT('╝')
  77. ╔════════════════════════════════════════════════════════════════════════════╗
  78. ║  Check ERROR() function after opening a file                               ║
  79. ╚════════════════════════════════════════════════════════════════════════════╝
  80. CheckOpen         PROCEDURE(File)
  81.  
  82.   CODE
  83.   OPEN(File,42h)                                 !Attempt to open the file
  84.   CASE ERRORCODE()                               ! and check for errors
  85.   OF NoError                                     !Return if no error
  86.   OROF IsOpenErr                                 ! or if already open.
  87.     RETURN
  88.   OF NoFileErr                                   !If file was not found
  89.     CREATE(File)                                 !Create the file
  90.     OPEN(File,42h)                               ! then open it
  91.     IF ~ERRORCODE() THEN RETURN.                 !  And return if it opened
  92.   OF InvalidFileErr                              !Invalid Record Declaration
  93.     GLO:Message1 = 'Error accessing: '& NAME(File)
  94.     GLO:Message2 = 'Code: ' & ERRORCODE() & ' ' & ERROR()
  95.     GLO:Message3 = 'Press OK to return to DOS'
  96.     ShowWarning
  97.     HALT(InvalidFileErr)
  98.   OF BadKeyErr                                   !Key Files must be rebuilt
  99.     GLO:Message1 = NAME(File) & ' Key file is invalid'
  100.     GLO:Message3 = 'Press OK to rebuild keyfile'
  101.     ShowWarning
  102.     OPEN(File,12H)                               !Open for exclusive access
  103.     BUILD(File)                                  !Rebuild the key files
  104.     IF ERRORCODE()
  105.       GLO:Message1 = NAME(File) & ' The file cannot be repaired'
  106.       GLO:Message2 = 'while other stations are using it'
  107.       GLO:Message3 = 'Press OK to return to DOS'
  108.       ShowWarning
  109.       HALT(BadKeyErr)
  110.     ELSE
  111.       CLOSE(File)                                !Close
  112.       OPEN(File,42h)                             ! then open it
  113.     END
  114.   END                                            !End of Case Structure
  115.   IF DiskError(NAME(File) & ' File could not be opened') THEN HALT(0). !Cannot resume
  116.  
  117. OMIT('╝')
  118. ╔════════════════════════════════════════════════════════════════════════════╗
  119. ║  Check ERROR() function after a disk access                                ║
  120. ╚════════════════════════════════════════════════════════════════════════════╝
  121. DiskError        FUNCTION(Cause)
  122. StopMsg::        STRING(180)
  123.  
  124.   CODE
  125.   IF ~ERRORCODE() THEN RETURN(0).                !Return with no error
  126.   IF ~OMITTED(1)                                 !If a cause was given
  127.     StopMsg:: = 'Cause: ' & Cause & LF:CR        !  Display it
  128.   END                                            !End IF
  129.   IF ERRORFILE()                                 !If error involves a file
  130.     StopMsg:: = CLIP(StopMsg::) & 'File : '  |   !  display the file
  131.               & ERRORFILE() & LF:CR
  132.   END                                            !End IF
  133.   StopMsg:: = CLIP(StopMsg::) & 'Error: '    |   !Display the error code
  134.             & ERRORCODE() & ' - '            |   !  and the error message
  135.             & ERROR() & LF:CR
  136.  
  137.   STOP(StopMsg::)                                !Stop with message
  138.   RETURN(1)                                      !Return with error
  139.  
  140. OMIT('╝')
  141. ╔════════════════════════════════════════════════════════════════════════════╗
  142. ║  Display a warning message using 3 Global message variables.               ║
  143. ╚════════════════════════════════════════════════════════════════════════════╝
  144. ShowWarning      PROCEDURE
  145.  
  146. SaveStyle        STRING(256)
  147.  
  148. Screen           SCREEN(9,53),PRE(SCR),CENTER,SHADOW,CUA,COLOR(112)
  149.                    ROW(1,1)    STRING('█▀{51}█'),COLOR(116)
  150.                    ROW(9,1)    STRING('█▄{51}█'),COLOR(116)
  151.                                REPEAT(7)
  152.                    ROW(2,1)      STRING('█'),COLOR(116)
  153.                    ROW(2,53)     STRING('█'),COLOR(116)
  154.                                .
  155.                    ROW(3,5)    ENTRY(@S45),USE(GLO:Message1),INS,SKIP,COLOR(112,112,112)
  156.                    ROW(4,5)    ENTRY(@S45),USE(GLO:Message2),INS,SKIP,COLOR(112,112,112)
  157.                    ROW(5,5)    ENTRY(@s45),USE(GLO:Message3),INS,SKIP,COLOR(112,112,112)
  158.                    ROW(7,24)   BUTTON('  &Ok  |'),SHADOW,USE(?Ok),COLOR(23,71,24,31,79)
  159.                  .
  160.  
  161.   CODE
  162.   SaveStyle = STYLES()                           !Save current style
  163.   GETSTYLES('')                                  !Turn off Styles
  164.   GLO:Message1 = CENTER(GLO:Message1,SIZE(GLO:Message1))
  165.   GLO:Message2 = CENTER(GLO:Message2,SIZE(GLO:Message2))
  166.   GLO:Message3 = CENTER(GLO:Message3,SIZE(GLO:Message3))
  167.   OPEN(Screen)
  168.   DISPLAY
  169.   ACCEPT                                         !Enable keyboard and mouse
  170.   CLEAR(GLO:MessageGroup)                        !Blank out message fields
  171.   SETSTYLES(SaveStyle)                           !Restore user styles
  172.   RETURN
  173.  
  174.