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_viewstr() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 C_VIEWSTR()

 DESCRIPTION

 C_VIEWSTR() displays a specified character string or memo field in
 a window with the given coordinates.  C_VIEWSTR() allows for text
 to be scrolled left and right or word-wrapped in the window.   An
 optional box type, color, shadow, and footer may be specified.
 Additionally, C_VIEWSTR() works with a user-defined function (UDF)
 to provide complete control including search options and moving and
 resizing the display window.

 SYNTAX

 C_VIEWSTR(st_row, st_col, end_row, end_col, text [,wrap] [,box] [,color]
 [,shadow] [,footer] [,udf])

 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.

 text (C) is the character string or memo field to display in the window.

 wrap (L) indicates whether the text should be word-wrapped or
 allowed to pan left and right.  Specify true (.T.) to enable word-
 wrapping or false (.F.) to allow panning.  For word-wrapped text,
 the width of the window is used to calculate the wrapping, tabs are
 expanded to 8 spaces, and soft carriage returns are converted.  If
 wrap is not specified, the default of true (.T.) is used.

 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_VIEWSTR() call.  udf should be passed in
 quotes and without parenthesis, for example, "VIEWSTR_UDF".  If udf
 is not specified, the default key control options are used.  (Refer
 to file UDF_VSTR.PRG on the ClipOn diskette for a functional UDF.)

 DEFAULT KEY DEFINITIONS AND ACTIONS (with no UDF)

 KEY PRESSED     ACTION TAKEN
 -----------     ------------
 ENTER           Exit C_VIEWSTR(), return zero
 ESC             Exit C_VIEWSTR(), 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 (if wrap option off)
 LT-ARROW        Pan left 10 columns (if wrap option off)
 CTRL-RT-ARROW   Pan right, all the way (if wrap option off)
 CTRL-LT-ARROW   Pan left, all the way (if wrap option off)

 PARAMETERS AND RETURN VALUES FOR THE UDF

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

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

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

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

 FUNCTION: _vsseek(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: _vsseek() returns true (.T.) if the text was found or
 false (.F.) if not found.

 FUNCTION: _vsmove(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: _vsmove() returns true (.T.) if the window was
 successfully moved or false (.F.) if the window could not be moved.

 FUNCTION: _vssize(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: _vssize() returns true (.T.) if the window was
 successfully resized or false (.F.) if the window could not be resized.

 RETURNS

 There is no return value.

 EXAMPLES

 xbuf = c_filegrab("TEST.TXT")      && read in text file

 ** Call using all defaults (word-wrap text)
 c_viewstr(10,10,20,69,xbuf)


 ** Call again with options and a UDF (word-wrap text)

 ft = "Press ESC to Exit"
 c_viewstr(10,10,20,69,xbuf,.t.,3,"W+/R",2,ft,"VSTR_UDF")


 ** Call again and enable right and left panning (disable word-wrap)

 ft = "Press ESC to Exit"
 c_viewstr(10,10,20,69,xbuf,.f.,3,"W+/R",2,ft,"VSTR_UDF")


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


See Also: C_VIEW() C_WVIEW()

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