home *** CD-ROM | disk | FTP | other *** search
- MEMBER('TOOLBOX')
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ TOOLBO01.CLA - Internal Source Module ! ║
- ╚════════════════════════════════════════════════════════════════════════════╝
-
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ HauptMenu - Hauptmenü !Generated Procedure ║
- ╚════════════════════════════════════════════════════════════════════════════╝
-
- HauptMenu PROCEDURE
-
-
- PDown PULLDOWN,COLOR(49,7,56,49,14),HALF(120)
- MENU('Stammdaten'),COLOR(112,7,120,126,14)
- ITEM('Bildschirmanzeige'),USE(?ZeigTxInhalt)
- ITEM('Ausdruck'),USE(?Ausdruck)
- ITEM('Index neu aufbauen'),USE(?Index_neu_aufba)
- ITEM('-')
- ITEM('Ende'),USE(?Ende),KEY(AltX)
- .
- .
-
- CODE
- OPEN(PDown) !Open the pulldown menu
- LOOP
- DISABLE(1,FIELDS()) !Disable any open screen
- ACCEPT !Enable mouse and keyboard
- ENABLE(1,FIELDS()) !Restore any open screen
- CLOSE(PDown) !Close the pulldown menu
- CASE KEYCODE()
- END
- CASE FIELD() !Jump to selected item
- OF ?ZeigTxInhalt !For a Pulldown field
- ZeigTxInhalt ! execute its procedure
- OF ?Ausdruck !For a Pulldown field
- DruckTxInhalt ! execute its procedure
- OF ?Index_neu_aufba !For a Pulldown field
- BuildKeys ! execute its procedure
- OF ?Ende !For a Pulldown field
- EMBED('~~HauptMenu~2~1~3~~')
- RETURN
-
- END ! execute its procedure
- END !End CASE
- OPEN(PDown) !Reopen the pulldown menu
- END !End LOOP
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ BearbeiteTxInhalt - Eingabemaske für Toolbox-Inhalt !Generated Procedure ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- BearbeiteTxInhalt PROCEDURE
-
- LOC:Message STRING(30)
- Action BYTE
- NoMoreFields BYTE(0) !No more fields flag
- SCREEN SCREEN(18,76),PRE(SCR),CENTER,SHADOW,FALL,CUA,COLOR(112)
- !dimensions=25,80,25,80
- ROW(1,49) PAINT(1,1),COLOR(17)
- ROW(1,1) STRING('█{27}'),COLOR(113)
- COL(28) STRING('Bearbeitung Datensatz'),COLOR(31)
- COL(50) STRING('█{27}'),COLOR(113)
- ROW(18,1) STRING('█▄{74}█'),COLOR(113)
- REPEAT(16)
- ROW(2,1) STRING('█'),COLOR(113)
- ROW(2,76) STRING('█'),COLOR(113)
- .
- ROW(2,24) ENTRY(@s30),USE(LOC:Message),SKIP,COLOR(126,7,120)
- ROW(4,3) PROMPT('Toolbox&index:'),COLOR(112,79,56,126,78)
- COL(17) ENTRY(@s14),USE(TxI:TxIndex),OVR,COLOR(48,79,56)
- ROW(5,10) PROMPT('Titel:'),COLOR(112,79,56,126,78)
- COL(17) ENTRY(@s58),USE(TxI:Titel),OVR,COLOR(48,79,56)
- ROW(6,5) PROMPT('Untertitel:'),COLOR(112,79,56,126,78)
- COL(17) ENTRY(@s58),USE(TxI:UTitel),OVR,COLOR(48,79,56)
- ROW(7,9) PROMPT('Rubrik:'),COLOR(112,79,56,126,78)
- COL(17) ENTRY(@s30),USE(TxI:Rubrik),OVR,COLOR(48,79,56)
- ROW(8,8) PROMPT('Ausgabe:'),COLOR(112,79,56,126,78)
- COL(17) ENTRY(@s10),USE(TxI:Ausgabe),OVR,COLOR(48,79,56)
- ROW(9,10) PROMPT('Seite:'),COLOR(112,79,56,126,78)
- COL(17) ENTRY(@s3),USE(TxI:Seite),OVR,COLOR(48,79,56)
- ROW(10,11) PROMPT('Name:'),COLOR(112,79,56,126,78)
- COL(17) ENTRY(@s30),USE(TxI:Name),OVR,COLOR(48,79,56)
- ROW(11,8) PROMPT('Vorname:'),COLOR(112,79,56,126,78)
- COL(17) ENTRY(@s30),USE(TxI:Vorname),OVR,COLOR(48,79,56)
- ROW(12,8) PROMPT('S&prache:'),COLOR(112,79,56,126,78)
- COL(17) ENTRY(@s30),USE(TxI:Sprache),OVR,COLOR(48,79,56)
- ROW(13,10) PROMPT('T&hema:'),COLOR(112,79,56,126,78)
- COL(17) ENTRY(@s30),USE(TxI:Thema),OVR,COLOR(48,79,56)
- ROW(14,6) PROMPT('Bemerkung:'),COLOR(112,79,56,126,78)
- COL(17) ENTRY(@s58),USE(TxI:Bemerkung),OVR,COLOR(48,79,56)
- ROW(16,23) BUTTON(' &Ok |'),SHADOW,KEY(EnterKey),USE(?Ok),REQ,COLOR(23,71,24,31,79)
- COL(43) BUTTON(' &Abbruch '),SHADOW,KEY(EscKey),USE(?Cancel),COLOR(23,71,24,31,79)
- .
-
- RecordQueue QUEUE,PRE(SAV) !Queue for concurrency checking
- SaveRecord LIKE(TxI:Record),PRE(SAV) !size of primary file record
- . !End Queue structure
- SavePointer STRING(10) !Position of current record
- AutoAddPtr STRING(10) !Position of autoinc record
- AutoIncAdd BYTE(0) !On for Autoincrement add
- LastPosition STRING(10) !Position of last ADD
-
- CODE
-
- CheckOpen(TxInhalt) !Ensure Primary file is OPEN
- CASE KEYCODE() !What Key was pressed?
- OF InsKey !Insert a new record
-
- Action = AddRecord !Set action code 1 (ADD)
- LOC:Message = CENTER(GLO:InsertMsg,SIZE(LOC:Message)) !Assign ADD message
- CLEAR(TxI:Record) !CLEAR Record buffer
-
- OF EnterKey !Process a CHANGE request
- OROF MouseLeft2 !on EnterKey or double mouse
-
- Action = ChangeRecord !Set action code 2 (CHANGE)
- LOC:Message = CENTER(GLO:ChangeMsg,SIZE(LOC:Message)) !Assign CHANGE message
- DO InitializeQueue !Save record to QUEUE
- SavePointer = POSITION(TxInhalt) !Save the record position
-
- OF DelKey !Process a DELETE request
-
- Action = DeleteRecord !Set action code 3 (DELETE)
- LOC:Message = CENTER(GLO:DeleteMsg,SIZE(LOC:Message)) !Assign DELETE message
- SavePointer = POSITION(TxInhalt) !Position in PRIMARY file
-
- END !End CASE Keycode
-
- OPEN(Screen) !Open the FORM screen
- DISPLAY !Display screen fields
- IF Action = DeleteRecord !IF request for DELETE
- DISABLE(1,FIELDS()) !Disable all screen fields
- ENABLE(?OK) !Enable the OK and the
- ENABLE(?Cancel) !Cancel buttons
- END !End IF request for delete
-
- LOOP !Begin Main process loop
-
- CASE SELECTED() !Process selected Field
- OF NoMoreFields !User pressed Enter or OK
- CASE Action !Process requested Action
- OF AddRecord !Action = 1 (ADD)
-
- ADD(TxInhalt) !Add Record to Primary file
- LastPosition = POSITION(TxInhalt)
-
- OF ChangeRecord !Action = 2 (Change)
-
- DO ConcurrentWrite !Concurrent update ROUTINE
- IF AbortWrite# !AbortWrite is on
- CYCLE !Let user choose response
- END !End AbortWrite#
- PUT(TxInhalt) !Write the Record
-
- OF DeleteRecord !Action = 3 (Delete)
-
- DO ConcurrentDelete !Concurrent update ROUTINE
- IF AbortDelete# !AbortWrite is on
- CYCLE !Restart main Loop
- ELSE !Its OK to Delete
- DELETE(TxInhalt) !Delete this record
- END !End AbortWrite#
- END !End CASE Action
-
- IF ERRORCODE() !Error check on File I/O
- IF ERRORCODE() = DupKeyErr ! Duplicate key detected
- IF DUPLICATE(TxI:TxIndexKey) !check unique keys
- GLO:Message3 = '[ '
- GLO:Message3 = Clip(GLO:Message3) & (' TxI:TxIndex ')
- GLO:Message3 = Clip(GLO:Message3)&' ]'
- END
- GLO:Message1 = 'This record creates a duplicate key entry'
- GLO:Message2 = 'The unique key field(s) are listed below: '
- ShowWarning !inform the user
- SELECT(1) !select first field
- DISPLAY !re-display the screen
- CYCLE !back to main loop
- END !End IF Duplicate errorcode
- CASE Action !Error message based on Action
- OF AddRecord
- GLO:Message1 = 'Error attempting to ADD Record'
- OF ChangeRecord
- GLO:Message1 = 'Error attempting to CHANGE Record'
- OF DeleteRecord
- GLO:Message1 = 'Error attempting to DELETE Record'
- END !End CASE Action
- GLO:Message2 = 'The file: TxInhalt could not be updated'
- GLO:Message3 = 'Code:'&Errorcode()&': '&Error()
- ShowWarning !Notify the user
- RELEASE(TxInhalt) !Release the held record
- FREE(RecordQueue) !FREE the memory Queue
- DISABLE(1,FIELDS()) !Disable all the fields
- ENABLE(?Cancel) !Enable Cancel button
- SELECT(?Cancel) !and place cursor on Cancel
- DISPLAY !Re-display the screen
- CYCLE !Re-start main LOOP
- ELSE !Else no errorcode()
- FREE(RecordQueue) !Free memory from Queue
- IF (Action = AddRecord) OR (Action = ChangeRecord AND AutoIncAdd)
- SELECT(1) !Place cursor on 1st field
- CYCLE !Re-start main LOOP
- END !End IF (Action = ....)
- BREAK !Break from main Loop
- END !End IF Errorcode()
-
- END !End CASE Selected()
-
- ACCEPT !Enable screen entry
-
- CASE FIELD() !Process fields
- OF ?Ok !On the OK button
-
- SELECT(1) !Start with the first field
- SELECT !and cycle non-stop
- CYCLE !restart main process loop
-
- OF ?Cancel !On Cancel button
-
- FREE(RecordQueue) !Free the memory Queue
- RESET(TxInhalt,LastPosition) !Position to record we added
- NEXT(TxInhalt) !and re-read
- BREAK !Break from main LOOP
- END !End CASE FIELD
-
- END !END MAIN PROCESS LOOP
-
-
- ConcurrentWrite ROUTINE
- AbortWrite# = 0 !Initialize AbortWrite#
- IF ~AutoIncAdd !Not an Autoincrement ADD
- Sav:SaveRecord = TxI:Record !Save Record to the Queue
- ADD(RecordQueue,2) !Add the changed record
- GET(RecordQueue,1) !Get the original record
- RESET(TxInhalt,SavePointer) !Position to record on disk
- HOLD(TxInhalt,2) !Set HOLD retry for 2 seconds
- NEXT(TxInhalt) !Read the record into buffer
- IF ERRORCODE() !Was there an error?
- CASE ERRORCODE() !Process recoverable errors
- OF IsHeldErr !Record is already held
- GLO:Message1 = 'The Record is locked by another workstation '
- GLO:Message2 = 'when you return to the entry FORM choose OK '
- GLO:Message3 = 'to try the update again, or CANCEL to abort '
- ShowWarning !Show user a warning
- SELECT(1) !Place cursor on 1st field
- RELEASE(TxInhalt) !Release the HOLD
- AbortWrite# = 1 !Turn on AbortWrite#
- EXIT !Back to main Loop
- ELSE !On any other error
- IF DiskError('File Access Error') !Call the Diskerror function
- RELEASE(TxInhalt) !Release the hold
- FREE(RecordQueue) !Free the memory Queue
- DISABLE(1,FIELDS()) !Disable all screen fields
- ENABLE(?Cancel) !Enable the Cancel button
- SELECT(?Cancel) !Place cursor on Cancel
- AbortWrite# = 1 !Turn on AbortWrite#
- EXIT !and exit the routine
- END !End IF Diskerror
- END !End CASE Errorcode()
- ELSIF Sav:SaveRecord <> TxI:Record !Has the record been changed
- Sav:SaveRecord = TxI:Record !Then update the Queue record
- PUT(RecordQueue) !Update the memory Queue
- GLO:Message1 = 'The Record was changed by another station '
- GLO:Message2 = 'your screen now reflects the changed data '
- GLO:Message3 = 'OK button to continue, or CANCEL to abort '
- ShowWarning !Notify the user of changes
- SELECT(1) !Place cursor on 1st field
- DISPLAY !Update the screen
- AbortWrite# = 1 !Turn AbortWrite# ON
- EXIT !Exit the Routine
- ELSE !Its ok to update the file
- GET(RecordQueue,2) !Retrieve the users changes
- TxI:Record = Sav:SaveRecord !Move changes to record buffer
- END !End IF Errorcode()
- END !End IF ~AutoIncAdd
-
-
-
- ConcurrentDelete ROUTINE
- AbortDelete# = 0
- RESET(TxInhalt,SavePointer) !Set position in Primary file
- HOLD(TxInhalt,2) !Hold the record
- NEXT(TxInhalt) !Read the record into buffer
- IF POSITION(TxInhalt) <> SavePointer !Is the record already deleted?
- RELEASE(TxInhalt) !Relase record Hold
- FREE(RecordQueue) !Free the memory Queue
- RETURN !Return to the calling procedure
- END !End IF position check
- IF ERRORCODE() !Check for file access error
- CASE ERRORCODE() !Case for recoverable errors
- OF IsHeldErr !Record is already held
- GLO:Message1 = 'The Record is locked by another workstation '
- GLO:Message2 = 'when you return to the entry FORM choose OK '
- GLO:Message3 = 'to try the update again, or CANCEL to abort '
- ShowWarning !Notify the user
- SELECT(1) !Place cursor on 1st field
- RELEASE(TxInhalt) !Release HOLD request
- AbortDelete# = 1 !Set AbortDelete# ON
- EXIT !Re-start main LOOP
- ELSE !for any other error
- IF DiskError('Unable to process current Record') !Call error function
- GLO:Message2 = 'Unable to continue, Press OK to exit'
- ShowWarning !Notify the user
- FREE(RecordQueue) !Free the memory queue
- RETURN !Return to calling procedure
- END !End IF Diskerror
- END !End CASE errorcode
- END !End IF errorcode()
-
- InitializeQueue ROUTINE !save initial record values
- Sav:SaveRecord = TxI:Record !Save the current record
- ADD(RecordQueue,1) !add record to Queue
- ADD(RecordQueue,2) !add record again
- IF ERRORCODE() !check Queue add error
- CASE ERRORCODE()
- OF NoMemErr !Is there enough memory?
- GLO:Message1 = 'Not Enough Memory to proceed'
- GLO:Message2 = 'with this operation . . . . '
- ShowWarning !Notify the user
- DISABLE(1,FIELDS()) !Disable the screen fields
- ENABLE(?Cancel) !Enable the Cancel button
- SELECT(?Cancel) !Place cursor on Cancel
- DISPLAY !Update screen display
- ELSE !On any other error
- GLO:Message1 = ERRORCODE() & ' ' & ERROR()
- GLO:Message2 = 'Unable to continue . . . .'
- ShowWarning !Show user the error
- DISABLE(1,FIELDS()) !Disable screen fields
- ENABLE(?Cancel) !Enable Cancel button
- SELECT(?Cancel) !Place cursor on Cancel
- DISPLAY !re-display the screen
- END !End CASE Errorcode
- END !End IF Errorcode
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ BuildKeys - !Generated Procedure ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- BuildKeys PROCEDURE
-
- SCREEN SCREEN(5,30),PRE(SCR),CUA,COLOR(112)
- !dimensions=25,80,25,80
- ROW(1,1) STRING('█{30}'),COLOR(113)
- ROW(3,4) STRING('Index wird neu aufgebaut')
- ROW(5,1) STRING('█▄{28}█'),COLOR(113)
- REPEAT(3)
- ROW(2,1) STRING('█'),COLOR(113)
- ROW(2,30) STRING('█'),COLOR(113)
- .
- .
-
-
- CODE
- OPEN(Screen) !Open the screen
- EMBED('~~BuildKeys~1~Setup Screen~3~~')
- BUILD(TxInhalt)
- RETURN
-
- END
-
- LOOP !Loop through the fields
- CASE SELECTED() !Jump to field setup routine
- END !End CASE
- ACCEPT !Enable the mouse and keyboard
- CASE FIELD() !Jump to field edit routine
- END !End CASE
- END !End LOOP
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ ZeigTxInhalt - Bildschirmübersicht Berichte !Generated Procedure ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- ZeigTxInhalt PROCEDURE
-
-
- Queue QUEUE
- STRING(215)
- .
-
-
- SCREEN SCREEN(25,80),PRE(SCR),CENTER,EXPAND(10),ZOOM,CUA,COLOR(112)
- !dimensions=25,80,25,80
- ROW(1,1) STRING('█{24}'),COLOR(113)
- COL(56) STRING('█{25}'),COLOR(113)
- ROW(25,1) STRING('█▄{78}█'),COLOR(113)
- REPEAT(23)
- ROW(2,1) STRING('█'),COLOR(113)
- ROW(2,80) STRING('█'),COLOR(113)
- .
- ROW(1,25) PROMPT('Toolbox Inhaltsverzeichnis 1992'),COLOR(31,31,31,31,31)
- ROW(4,4) LIST(17,74),FROM(Queue),FIX(2),HVSCROLL,USE(?List),IMM,COLOR(48,15,120)
- ROW(23,4) BUTTON(' &Neu |'),SHADOW,USE(?Insert),COLOR(23,71,24,31,79)
- COL(14) BUTTON(' &Bearbeiten |'),SHADOW,USE(?Bearbeiten),COLOR(23,71,24,31,79)
- COL(31) BUTTON(' &Löschen |'),SHADOW,USE(?Delete),COLOR(23,71,24,31,79)
- COL(69) BUTTON(' &Ende |'),SHADOW,KEY(EscKey),USE(?Ende),COLOR(23,71,24,31,79)
- .
-
-
- CODE
- CheckOpen(TxInhalt) !Ensure TxInhalt file is open
- FREE(Queue) !Make sure Queue is empty
- OPEN(Screen) !Open the screen
- DISPLAY !Display innitialized fields
- Queue = 'Thema' & |
- ' {26}' & 'Rubrik' & |
- ' {25}' & 'Name' & |
- ' {27}' & 'Ausgabe' & |
- ' ' & 'Seite Sprache' & |
- ' {24}' & 'Bemerkung' !Add fixed listbox line
- ADD(Queue) ! to the Queue
- Queue = '─{200}' !Add fixed listbox line
- ADD(Queue) ! to the Queue
- BeginBrowse(?List) !Begin a browse session
- LOOP !Process browse requests
- CASE BrowseAction(TxInhalt,TxI:TxIndexKey,Queue) !Browse the file
-
- OF FormatQueue !Format a queue element
- Queue = FORMAT(TxI:Thema,@s30) & |
- '│' & |
- FORMAT(TxI:Rubrik,@s30) & |
- '│' & |
- FORMAT(TxI:Name,@s30) & |
- '│' & |
- FORMAT(TxI:Ausgabe,@s10) & |
- '│' & |
- ' ' & FORMAT(TxI:Seite,@s3) & |
- '│' & |
- FORMAT(TxI:Sprache,@s30) & |
- '│' & |
- FORMAT(TxI:Bemerkung,@s74) !Format the listbox queue
-
- OF ProcessField !Process a field
-
- CASE KEYCODE()
- END
-
- CASE FIELD() !Jump to edit routine
- OF ?Insert !Process the Insert Button
- GET(TxInhalt,0) ! Dereference current record
- SETKEYCODE(InsKey) ! Set action to Insert
- BearbeiteTxInhalt ! Run the update procedure
- SELECT(?List) ! Reselect the List field
- OF ?Delete !Process the Delete Button
- SETKEYCODE(DelKey) ! Set action to Delete
- BearbeiteTxInhalt ! Run the update procedure
- SELECT(?List) ! Reselect the List field
- OF ?List !Process the list field
- CASE KEYCODE() ! Jump to keycode routine
- OF InsKey ! For the insert key
- GET(TxInhalt,0) ! Dereference current record
- BearbeiteTxInhalt ! Run the update procedure
- OF DelKey ! For the delete key
- BearbeiteTxInhalt ! Run the update procedure
- END ! End CASE
- OF ?Bearbeiten !Edit Procedure or source
- BearbeiteTxInhalt ! for ?Bearbeiten
- OF ?Ende !Edit Procedure or source
- EMBED('~~ZeigTxInhalt~4~5~3~~')
- RETURN
-
- END ! for ?Ende
- END
-
- OF NoRecords !No records to browse
- IF RECORDS(TxInhalt) !If file is not empty
- IF ?List <> 1 ! And list is not first
- SELECT(1) ! Select the first field
- ELSE ! End IF
- SELECT(?Insert) ! Select the Insert Button
- END ! End IF
- ELSE !If file is empty
- GET(TxInhalt,0) ! Dereference current record
- SETKEYCODE(InsKey) ! Ask for a new record
- BearbeiteTxInhalt ! Run the update procedure
- IF POSITION(TxI:TxIndexKey) = '' ! If record not added
- BREAK ! Return to caller
- END ! End IF
- END !End IF
-
- END !End CASE
- END !End LOOP
- EndBrowse !End the browse session
- FREE(Queue) !Free the Queue memory
-
-
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ DruckTxInhalt - !Generated Procedure ║
- ╚════════════════════════════════════════════════════════════════════════════╝
-
- DruckTxInhalt PROCEDURE
-
- LineCounter BYTE
- PageCounter SHORT
- ReportDevice STRING('LPT1 {25}')
-
-
- SCREEN SCREEN(6,22),PRE(SCR),CENTER,SHADOW,ZOOM,CUA,COLOR(112)
- !dimensions=25,80,25,80
- ROW(1,1) STRING('█▀{20}█'),COLOR(113)
- ROW(2,5) STRING('Erzeuge Report'),COLOR(113)
- ROW(6,1) STRING('█▄{20}█'),COLOR(113)
- REPEAT(4)
- ROW(2,1) STRING('█'),COLOR(113)
- ROW(2,22) STRING('█'),COLOR(113)
- .
- ROW(4,5) PROMPT('Seite:'),COLOR(113,116,120,127,127)
- COL(11) ENTRY(@n6),USE(PageCounter),SKIP,COLOR(126,7,120)
- ROW(5,5) PROMPT('Zeile:'),COLOR(113,116,120,127,127)
- COL(14) ENTRY(@n3),USE(LineCounter),SKIP,COLOR(126,7,120)
- .
-
- REPORT REPORT LENGTH(66),WIDTH(80),PAGE(PageCounter),LINE(LineCounter),PRINTER('GENERIC PRINTER'),PRE(RPT),DEVICE(ReportDevice)
- PageHead HEADER
- ROW(1,1) STRING('Toolbox-Inhalt bis 5/93 {38}Seite:')
- COL(69) STRING(@n6),USE(PageCounter)
- ROW(2,1) STRING('─{74}')
- ROW(3,1) STRING('Toolbox-Index Rubrik {25}Ausgabe Seite')
- ROW(4,1) STRING('Thema {26}Sprache')
- ROW(5,1) STRING('Name {27}Vorname')
- ROW(6,1)
- ROW(7,1) STRING('Titel')
- ROW(8,1) STRING('Untertitel')
- ROW(9,1) STRING('Bemerkung')
- ROW(10,1) STRING('═{74}')
- .
- Detail DETAIL
- ROW(1,1) STRING(14),USE(TxI:TxIndex)
- COL(16) STRING(30),USE(TxI:Rubrik)
- COL(47) STRING(10),USE(TxI:Ausgabe)
- COL(58) STRING(3),USE(TxI:Seite)
- ROW(2,1) STRING(30),USE(TxI:Thema)
- COL(32) STRING(30),USE(TxI:Sprache)
- ROW(3,1) STRING(30),USE(TxI:Name)
- COL(32) STRING(30),USE(TxI:Vorname)
- SUPPRESS(3)
- ROW(4,1)
- ROW(5,1) STRING(74),USE(TxI:Titel)
- ROW(6,1) STRING(74),USE(TxI:UTitel)
- SUPPRESS(6)
- ROW(7,1) STRING(74),USE(TxI:Bemerkung)
- SUPPRESS(7)
- ROW(8,1) STRING('─{74}')
- . .
-
-
- CODE
- CheckOpen(TxInhalt) !Ensure TxInhalt file is open
- RedirectReport !Call redirection procedure
- CASE GLO:FileSpec !Detect redirection selection
- OF 'CANCEL' !Cancel report requested
- RETURN
- OF 'SCREEN' !Screen view requested
- Temp" = COMMAND('CLATMP',0) !Get temporary file directory
- IF NOT Temp" !None set?
- Temp" = 'TempRpt.$$$' !Assign temporary filename
- ELSIF SUB(CLIP(Temp"),-1,1) = '\'
- Temp" = CLIP(Temp") & 'TempRpt.$$$' !Assign temporary filename
- ELSE
- Temp" = CLIP(Temp") & '\' & 'TempRpt.$$$' !Assign temporary filename
- END
- ReportDevice = Temp"
- GLO:FileSpec = Temp"
- ELSE !All other report devices
- ReportDevice = GLO:FileSpec ! go to the device
- Temp" = SUB(LEFT(UPPER(GLO:FileSpec)),1,3) !Get first three characters
- IF (Temp" = 'LPT' OR Temp" = 'COM') AND NUMERIC(SUB(LEFT(GLO:FileSpec),4,1))
- IF Temp" = 'LPT' and NOT STATUS(GLO:FileSpec) !Check printer status
- GLO:Message1 = 'The Printer is Off-Line!'
- GLO:Message2 = 'Please correct this situation'
- ShowWarning !Notify the user if off-line
- RETURN
- END
- GLO:FileSpec = '' !Disable viewing
- END
- END
- OPEN(REPORT) !Prepare to print report
- SET(TxI:TxIndexKey) !Top of file, keyed order
- OPEN(Screen)
- LOOP !Primary file process loop
- NEXT(TxInhalt) !Get each TxInhalt record
- IF ERRORCODE() THEN ErrEndFileFlag# = 1 ELSE ErrEndFileFlag# = 0. !Flag EOF
- IF ErrEndFileFlag# THEN BREAK. !End of file? Terminate report
-
- PRINT(RPT:Detail) !Print line item detail
- DISPLAY !Display report progress
-
- LOOP WHILE KEYBOARD() !If any keystrokes waiting
- ASK ! in the buffer, get them
- IF KEYCODE() = EscKey !Detect the ESC key
- CLOSE(REPORT) ! close the report
- RETURN ! and get out
- END
- END !End abort key loop
- END !End TxInhalt file loop
- CLOSE(REPORT) !Close report
- CLOSE(Screen) !Close report progress screen
- ViewReport !Call View Procedure
-
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ RedirectReport - !Generated Procedure ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- RedirectReport PROCEDURE
-
- Destination STRING(6)
- FileName STRING(64)
- SCREEN SCREEN(12,48),PRE(SCR),CENTER,SHADOW,ZOOM,CUA,COLOR(112)
- !dimensions=25,80,25,80
- ROW(1,1) STRING('█{48}'),COLOR(113)
- ROW(2,3) STRING('┌─')
- COL(16) STRING('─{30}┐')
- ROW(6,3) STRING('└─{42}┘')
- ROW(12,1) STRING('█▄{46}█'),COLOR(113)
- REPEAT(3)
- ROW(3,3) STRING('│')
- ROW(3,46) STRING('│')
- .
- REPEAT(10)
- ROW(2,1) STRING('█'),COLOR(113)
- ROW(2,48) STRING('█'),COLOR(113)
- .
- ROW(2,5) PROMPT('Ausgabe an:'),COLOR(113,116,120,127,127)
- OPTION,USE(Destination)
- ROW(3,6) RADIO('LPT1'),OVR,COLOR(113,126,120,126,127)
- COL(16) RADIO('LPT2'),OVR,COLOR(113,126,120,126,127)
- COL(26) RADIO('LPT3'),OVR,COLOR(113,126,120,126,127)
- COL(36) RADIO('LPT4'),OVR,COLOR(113,126,120,126,127)
- ROW(4,6) RADIO('COM1'),OVR,COLOR(113,126,120,126,127)
- COL(16) RADIO('COM2'),OVR,COLOR(113,126,120,126,127)
- COL(26) RADIO('COM3'),OVR,COLOR(113,126,120,126,127)
- COL(36) RADIO('COM4'),OVR,COLOR(113,126,120,126,127)
- ROW(5,6) RADIO('DATEI'),OVR,COLOR(113,126,120,126,127)
- COL(16) RADIO('BILDSCHIRM'),OVR,COLOR(113,126,120,126,127)
- .
- ROW(8,4) PROMPT('Dateiname:'),COLOR(113,116,120,127,127)
- COL(15) ENTRY(@s31),USE(FileName),OVR,COLOR(126,7,120)
- ROW(10,13) BUTTON(' &Ok |'),SHADOW,KEY(EnterKey),USE(?Ok),COLOR(23,71,24,31,79)
- COL(26) BUTTON(' &Abbruch |'),SHADOW,KEY(EscKey),USE(?Cancel),COLOR(23,71,24,31,79)
- .
-
- CODE
- OPEN(Screen)
- LOOP
- ACCEPT !Accept input
-
- CASE FIELD()
- OF ?Destination
- EMBED('~~RedirectReport~4~3~7~~')
- IF Destination = 'FILE'
- ENABLE(?FileName)
- SELECT(?FileName)
- ELSE
- DISABLE(?FileName)
- GLO:FileSpec = Destination
- END
-
- END
-
- OF ?FileName
- EMBED('~~RedirectReport~4~4~7~~')
- GLO:FileSpec = FileName
- END
-
- OF ?Ok
- EMBED('~~RedirectReport~4~5~7~~')
- RETURN
- END
-
- OF ?Cancel
- EMBED('~~RedirectReport~4~6~7~~')
- GLO:FileSpec = 'CANCEL'
- RETURN
- END
-
- END
- END
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ ViewReport - !Generated Procedure ║
- ╚════════════════════════════════════════════════════════════════════════════╝
-
- ViewReport PROCEDURE
-
- ListQueue QUEUE,PRE(QUE)
- QueueLine STRING(255)
- .
- StatusLine STRING(80)
- PrintDevice STRING(4)
- SaveRows BYTE !Initial screen rows
- SaveCols BYTE !Initial screen columns
- FirstPage BYTE
- RptFile FILE,DRIVER('ASCII'),NAME(GLO:FileSpec),PRE(Dos) ! Declare Input File
- RECORD
- Fline STRING(255)
- . .
-
- REPORT REPORT LENGTH(59),WIDTH(80),PRINTER('GENERIC PRINTER'),PRE(RPT),DEVICE(PrintDevice)
- Detail DETAIL
- ROW(1,1) STRING(80),USE(QUE:QueueLine)
- .
- PageFoot FOOTER
- ROW(1,1)
- COL(1) CONTROL('FORMFEED')
- . .
- SCREEN SCREEN(25,80),PRE(SCR),AT(1,1),EXPAND(10),CUA,COLOR(113)
- !dimensions=25,80,25,80
- ROW(1,1) LIST(22,80),FROM(QUE:QueueLine),HVSCROLL,USE(?List),IMM,COLOR(112,113,120)
- ROW(23,7) PROMPT('Print to:'),COLOR(113,116,119,127,127)
- OPTION,USE(PrintDevice)
- COL(17) RADIO('LPT1'),OVR,COLOR(113,126,119,126,127)
- COL(27) RADIO('LPT2'),OVR,COLOR(113,126,119,126,127)
- COL(37) RADIO('LPT3'),OVR,COLOR(113,126,119,126,127)
- COL(47) RADIO('LPT4'),OVR,COLOR(113,126,119,126,127)
- COL(57) RADIO('COM1'),OVR,COLOR(113,126,119,126,127)
- COL(67) RADIO('COM2'),OVR,COLOR(113,126,119,126,127)
- .
- COL(1) ENTRY(@s80),USE(StatusLine),SKIP,COLOR(126,7,119)
- ROW(24,4) BUTTON(' 25/50 &Modus |'),SHADOW,USE(?ChangeMode),COLOR(23,71,24,31,79)
- COL(37) BUTTON(' &Drucken '),SHADOW,USE(?Print),COLOR(23,71,24,31,79)
- COL(70) BUTTON(' E&nde |'),SHADOW,KEY(EscKey),USE(?Exit),COLOR(23,71,24,31,79)
- .
-
- VEW::Length BYTE ! Progress variable
- VEW::ProgString STRING('{50}') ! Progress display variable
-
- CODE
- IF NOT GLO:FileSpec THEN RETURN. !If GLO:FileSpec is blank
- OPEN(RptFile) !Open the Dos File
- IF DiskError('Cannot Locate Selected File') THEN RETURN.
- IF Bytes(RptFile) > (150 * 1024) ! If oversized file
- GLO:Message1 = 'This is a large file and may take a while'
- GLO:Message2 = 'to load. You may press the Esc key'
- GLO:Message3 = 'while the file is loading to exit.'
- ShowWarning ! Show a warning screen
- END !End IF
- OPEN(Screen) !Open the Screen
- DISABLE(?PrintDevice) !Disable the device field
- SaveRows = Rows(SCREEN) !Save the Screen Rows
- SaveCols = Cols(SCREEN) !Save the Screen Columns
- FirstPage = 1 !Set flag for Page 1
- SET(RptFile) !Set to the file
- LOOP !Loop through the dos file
- NEXT(RptFile) ! Get the next record
- IF ERRORCODE() THEN BREAK. !
- IF Bytes(RptFile) > 150 ! Line is longer than allowed
- GLO:Message1 = 'The line length is greater than 150.'
- GLO:Message2 = 'The selected file is not an ASCII file.'
- GLO:Message3 = 'No view on this file is available.'
- ShowWarning ! Show an error message
- FREE(ListQueue) ! Free memory table
- CLOSE(RptFile) ! Close the DOS file
- CLOSE(SCREEN) ! Close the Screen
- RETURN ! Return back to caller
- END !End IF
- IF NOT (((POINTER(RptFile)+100)%100)) !Show the progess indicator
- VEW::Length += 1
- StatusLine = ' Reading File: ' & SUB(VEW::ProgString,1,VEW::Length)
- IF VEW::Length = 50
- VEW::Length = 1
- StatusLine = ' Reading File: ' & ' {70}'
- END
- Display(?StatusLine)
- END
- Que:QueueLine = Dos:Fline ! Fill the queue line.
- ADD(ListQueue) ! Add to the queue
- IF ERRORCODE() ! If out of memory
- GLO:Message1 = 'Error: ' & ERROR() !
- GLO:Message2 = 'This file is too large to be read into memory.'
- GLO:Message3 = 'The entire file will not be displayed.'
- ShowWarning ! Show an error message
- BREAK ! Break out of read loop
- END ! End IF
-
- IF FirstPage ! If page 1
- IF RECORDS(ListQueue) = ROWS(SCREEN) ! If we have a full screen
- FirstPage = 0 ! turn off the page flag
- DISPLAY ! and display page 1
- END ! End IF
- END ! End IF
- LOOP WHILE KEYBOARD() ! While Keyboard Input
- SELECT(?List) ! Select the List box
- ACCEPT ! Handle internal keystrokes
- END ! End LOOP
- IF KEYCODE() = EscKey THEN BREAK.
- END !End LOOP
- StatusLine = 'Viewing: ' & GLO:FileSpec ! fill the statusline
- DISPLAY !Display the screen
- LOOP !Process the screen
- ACCEPT !Accept input
- CASE FIELD() !Which field was completed
- OF ?PrintDevice !Selected a port for printer
- ! Insert Edit Routine
- DISABLE(?PrintDevice) ! Disable the PrintDevice
- ENABLE(?StatusLine) ! Enable the StatusLine
- SELECT(?Print) ! Select the Print button
- PRESS(EnterKey) ! And complete it.
- OF ?ChangeMode !Completed mode button
- IF ROWS(SCREEN) = 25 ! If in 25 line mode
- CLOSE(SCREEN) ! Close the current screen
- SETTEXT(50,80) ! Set to 50 line mode
- ELSE ! Else in 43 or 50 line mode
- CLOSE(SCREEN) ! Close the current screen
- SETTEXT(25,80) ! Set to 25 line mode
- SETAREA(25,80) ! Resize the screen area
- LOADSYMBOLS ! Reload graphic mouse
- END ! End IF
- OPEN(SCREEN) ! Open screen in new mode
- DISABLE(?PrintDevice) ! Disable the device field
- DISPLAY ! Display the fields
- ! Insert Edit Routine
- OF ?Print !Completed Print Button
- ! Insert Edit Routine
- IF NOT PrintDevice ! If no print device selected
- DISABLE(?StatusLine) ! Disable the StatusLine
- ENABLE(?PrintDevice) ! Enable the PrintDevice
- SELECT(?PrintDevice) ! Select the PrintDevice
- CYCLE ! Cycle to accept input
- END ! End IF
- IF NOT STATUS(PrintDevice) ! Check PrintDevice status
- GLO:Message1 = CLIP(PrintDevice) & ' is not ready.'
- GLO:Message2 = 'Be sure the Printer is online and attached to'
- GLO:Message3 = 'the specified device and try again.'
- ShowWarning ! Show an error message
- PrintDevice = '' ! Clear the PrintDevice
- CYCLE ! Cycle to accept input
- END ! End IF
- OPEN(REPORT) ! Open the report to print
- LOOP I# = 1 to RECORDS(ListQueue) ! Loop while QUEUE records
- GET(ListQueue,I#) ! Get the line
- IF ERRORCODE() THEN BREAK. ! Break if an error occurs
- PRINT(RPT:Detail) ! Print the line
- IF KEYBOARD() ! If keyboard input
- ACCEPT ! Get the keystroke
- IF KEYCODE() = EscKey ! If the ESCAPE key
- BREAK ! Break from printing
- END ! End IF
- END ! End IF
- END ! End LOOP
- CLOSE(REPORT) ! Close the report
- PrintDevice = '' ! Clear the printer variable
- OF ?Exit !Completed Exit Button
- ! Insert Edit Routine
- BREAK ! Break out of the loop
- END ! End CASE FIELD()
- END !End LOOP
- FREE(ListQueue) !Free memory table
- CLOSE(RptFile) !Close the DOS file
- CLOSE(SCREEN) !Close the Screen
- IF Rows(SCREEN) <> SaveRows | !If the mode is not the same
- OR SaveCols <> Cols(SCREEN) !as when we entered
- SETTEXT(SaveRows,SaveCols) ! Reset to the entry mode
- SETAREA(SaveRows,SaveCols) ! Resize the screen area
- LOADSYMBOLS ! Reload graphic mouse
- END !End IF
-