Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- ClipOn 3.0 Reference - c_view() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 C_VIEW()

 DESCRIPTION

 C_VIEW() displays the given text file in a window with the
 specified coordinates.  The text file may be scrolled up, down,
 left, and right.  C_VIEW() will display any size text file and uses
 a minimal amount of memory to manipulate the file.  An optional box
 type, color, shadow, and footer may be specified.  C_VIEW() works
 with a callable user-defined function (UDF) to provide complete
 control including search options and moving and resizing the
 display window.

 NOTES

 The maximum line width that C_VIEW() can read is 500 characters.

 Each line in the text file must be terminated with a new-line
 character (ASCII 13 + 10).

 The text file should contain an end-of-file marker (ASCII 26).

 When Clipper output is sent to a file using the SET PRINTER TO
 <file> command, the DOS text file created is not terminated with an
 EOF marker and therefore should be converted using the C_FILECNTZ()
 function.

 SYNTAX

 C_VIEW(st_row, st_col, end_row, end_col, file [,box] [,color] [,shadow]
 [,footer] [,udf] [,network])

 PARAMETERS

 st_row (N), st_col (N), end_row (N), and end_col (N) define the
 upper left and lower right coordinates for the window.

 file (C/N) is the name of the text file or the file handle number
 of an opened text file to view.  If a file name is specified, it
 must be closed before calling the function.

 box (N) is the box type (0 - 5) to draw for the window.  If box is
 not specified, box type 2 (double box) is used.  The box types are
 as follows:

 BOX TYPE     DESCRIPTION
 --------     -----------
 0            No box
 1            Single top/bottom, single sides
 2            Double top/bottom, double sides
 3            Double top/bottom, single sides
 4            Single top/bottom, double sides
 5            Solid graphics characters

 color (C) is the color of the window.

 shadow (N) is the type of shadow to display around the window.  The
 shadow types are as follows:  0 = no shadow, 1 = left side/bottom
 shadow, 2 = right side/bottom shadow.  If shadow is not specified,
 no shadow is displayed.

 footer (C) is the footer line which is displayed at the bottom of
 the window.

 udf (C) is the name of the user-defined function (UDF) to maintain
 a dialog with during the C_VIEW() call.  udf should be passed in
 quotes and without parenthesis, for example, "VIEW_UDF".  If udf is
 not specified, the default key control options are used.  (Refer to
 file UDF_VIEW.PRG on the ClipOn diskette for a functional UDF.)

 network (L) indicates whether or not the program is running on a
 network.  If the program is running on a network pass true (.T.) so
 the file can be opened with the proper share access, otherwise pass
 false (.F.).  If network is not specified, the default of false (.F.)
 is used.

 DEFAULT KEY DEFINITIONS AND ACTIONS (with no UDF)

 KEY PRESSED     ACTION TAKEN
 -----------     ------------
 ENTER           Exit C_VIEW(), return zero
 ESC             Exit C_VIEW(), return zero
 HOME            Display first full page
 END             Display last full page
 PGUP            Display previous page
 PGDN            Display next full page
 UP-ARROW        Scroll window up one line
 DN-ARROW        Scroll window down one line
 RT-ARROW        Pan right 10 columns
 LT-ARROW        Pan left 10 columns
 CTRL-RT-ARROW   Pan right, all the way
 CTRL-LT-ARROW   Pan left, all the way

 PARAMETERS AND RETURN VALUES FOR THE UDF

 The user-defined function for C_VIEW() receives the following
 parameters when called:

 Mode - current mode state of C_VIEW(), where:
   0 = Startup
   1 = Request action
   2 = Report previous action
 Prev_action - the previous action taken by C_VIEW()
 Pan_offset - current offset of position left and right (1 is startup)

 The following action codes can be returned to C_VIEW() to tell it
 what action to take:
 -1 = Ignore key, continue
 0  = Exit C_VIEW(), return 0
 2  = Perform default action based on last key pressed (automatic mode)
 4  = Redisplay current screen in window
 10 = Top of file
 11 = Bottom of file
 12 = Page up
 13 = Page down
 14 = Scroll up one
 15 = Scroll down one
 20 = Pan right - all the way
 21 = Pan left - all the way
 22 = Pan right - 10 columns
 23 = Pan left - 10 columns

 C_VIEW() FUNCTIONS CALLED FROM THE UDF (SEEK, MOVE, RESIZE WINDOW)

 FUNCTION: _vseek(curr_line, string, exact_match)

 curr_line (N) is the position to begin the search.  Specify zero
 (0) to begin at the current line or one (1) to begin on the next line.
 string (C) is the character string or single character to find.
 exact_match (L) indicates whether or not the search should be case
 sensitive.  Specify true (.T.) to search for an exact match or
 false (.F.) to ignore the upper or lower case of the match.

 Returns: _vseek() returns true (.T.) if the string was found or
 false (.F.) if not found.

 FUNCTION: _vmove(dir, count)

 dir (C) is the direction to move the window. (U=Up, D=Down, R=Right, L=Left)
 count (N) is the number of rows or columns to move the window in
 the direction specified by dir.

 Returns:  _vmove() returns true (.T.) if the window was
 successfully moved or false (.F.) if the window could not be moved.

 FUNCTION: _vsize(dir, count)

 dir (C) is the direction to resize the window starting from the
 bottom going up and down or from the right going left and right.
 (U=Up, D=Down, R=Right, L=Left)
 count (N) is the number of rows or columns to resize the window in
 the direction specified by dir.

 Returns:  _vsize() returns true (.T.) if the window was
 successfully resized or false (.F.) if the window could not be resized.

 RETURNS

 C_VIEW() returns a zero (0) if the file was successfully opened and
 closed, otherwise a negative one (-1) is returned indicating an
 error occurred opening the file.

 EXAMPLES

 ** Call C_VIEW() to view the file test.txt
 c_view(10,10,20,69,"TEST.TXT",3,"W+/R",1)

 ** Use C_VIEW() to preview a Clipper report after redirecting
 ** output to a file.

 set print on
 set device to print            && set output to printer
 set printer to REPORT.TXT      && redirect to file

 ** DO REPORT PROCEDURE

 set printer to                 && close report file
 set print off
 set device to screen

 ** Use C_FILECNTZ() to add an end-of-file marker to "REPORT.TXT"
 ** (see function C_FILECNTZ() for more information)

 c_filecntz("REPORT.TXT")

 ** Call C_VIEW() to view report with a box, shadow, and footer
 ** Use the standard udf "view_udf" in the file udf_view.prg

 ft = " F1-Help   |   PgUp   |   PgDn   |   Home   |   End   |   ESC-Exit"

 c_view(5,5,20,74,"REPORT.TXT",4,"w/b",2,ft,"view_udf")

 Note that in the examples above, the code for the callable UDF
 "VIEW_UDF" is contained in the file UDF_VIEW.PRG on the ClipOn diskette.


See Also: C_VIEWSTR() C_WVIEW() C_FILECNTZ()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson