Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>memoline()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
MEMOLINE()


Syntax:     MEMOLINE(<expC> [,<expN1>] [,<expN2>] [,<expN3>]
            [,<expL>])

Purpose:    To extract a formatted line of text from a character string
            or memo field.

Arguments:  <expC> is the memo field or character string from which
            to extract lines of text.

            <expN1> is the number of characters per line.  The
            default is 79, the maximum is 254, and the minimum is four.
            <expN2> is the line number to extract.  The default is one.

            <expN3> is the tab size.  The default is four.  If
            <expN3> is greater than or equal to <expN1>, then the tab
            size is <expN1> - 1.

            <expL> toggles word wrap on and off.  Specifying true
            (.T.) toggles word wrap on; false (.F.) toggles it off.  The
            default is true (.T.).

            Note that most arguments are optional.  To skip an argument
            and specify further arguments, pass a dummy argument for the
            argument you wish to skip.

Returns:    A character string.

            MEMOLINE() returns the line specified by <expN2> in <expC>
            based on the number of characters per line (<expN1>), the
            tab size (<expN3>), and wrapping behavior (<expL>).

            If <expL> is true (.T.) and an end-of-line position breaks a
            word, it is word-wrapped to the next line.  The next line
            then begins with that word.  If <expL> is false (.F.),
            MEMOLINE() returns the number of characters specified by the
            line width (<expN1>).  The next line begins with the
            character following the next hard carriage return.  This
            means that the intervening characters are truncated.

            If the line has fewer characters than the indicated width,
            it is padded with blanks.  If the line number is greater
            than the total number of lines in the expression, MEMOLINE()
            returns a null string ("").

Usage:      MEMOLINE() is designed to be used in combination with
            MLCOUNT() to extract lines of text from character strings
            and memo fields based on the number of characters per line.
            The basic method of operation is to determine the number of
            lines in the memo field or character string using MLCOUNT(),
            the number of characters per line, the tab size, and the
            wrapping behavior.  Then navigate through the memo or
            character string with FOR...NEXT using the result of
            MLCOUNT() as the upper boundary of the loop.  Within the
            loop, extract the current line with MEMOLINE() using the
            same values for the characters per line, tab size, and word
            wrap arguments.

Library:    EXTEND.LIB


----------------------------------- Example --------------------------------

   The following example prints a memo field (Notes) which starts on row
   12, at column 10, and is 40 characters wide.

   row = 0
   col = 10
   width = 40
   tab = 3
   wrap =.T.

   SET DEVICE TO PRINT

   * Get number of formatted lines in memo.
   line_cnt = MLCOUNT(Notes, width, tab, wrap)

   * Walk through the memo one line at a time.
   FOR curr_line = 1 TO line_cnt

      * Extract the current line.
      print_line = MEMOLINE(Notes, width, curr_line, tab, wrap)

      * Display the current line.
      @ row + curr_line - 1, col SAY print_line

   NEXT

   SET DEVICE TO SCREEN


See Also: MEMOEDIT() MLCOUNT() MLPOS()

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