Displaying a log file

Status
Not open for further replies.

tgounden

New Member
Hi All,

I need code to display a log file on the screen . The user will need to be able to scroll up or down. I am using Progress 83C on a Unix server in character mode. Any ideas will be greatly appreciated.:)
 

NickA

Member
Use a editor widget - works in GUI or CHUI

Set up a character variable as a large editor widget, then load the log file into it..

Example:
Code:
DEFINE VARIABLE cLogFile  AS CHARACTER INITIAL "logs/log.txt" NO-UNDO.
DEFINE VARIABLE cLogViewer AS CHARACTER VIEW-AS EDITOR NO-WORD-WRAP
                SCROLLBAR-HORIZONTAL SCROLLBAR-VERTICAL
                LARGE SIZE 70 BY 18 NO-UNDO.

FORM
    cLogViewer
  WITH FRAME frMain NO-LABELS.

DO WITH FRAME frMain ON ENDKEY UNDO, LEAVE:

  DISPLAY cLogViewer.
  ASSIGN cLogViewer:READ-ONLY = TRUE.
  cLogViewer:INSERT-FILE( cLogFile ) NO-ERROR.

  ENABLE cLogViewer.
  WAIT FOR END-ERROR OF FRAME frMain.

END.
 

tgounden

New Member
Thanks agian NickA,

I have tried the code which loads the log file fine except that the user sees the bottom of the file rather than the top - is there anyway to display the top of the file so that the user scrolls downward.

:)
 

NickA

Member
Yes

I think you're looking for the 'SET-SELECTION' method.

Code:
cLogViewer:SET-SELECTION(1,2).

The first parameter specifies the offset of the first character to be selected. The second parameter specifies the offset of the first character after the selection.
 
Status
Not open for further replies.
Top