CT_MAXLINE

 MAXLINE()
 Finds the longest line within a string
------------------------------------------------------------------------------
 Syntax

     MAXLINE(<cString>) --> nLength

 Argument

     <cString>  Designates the string that is processed.

 Returns

     The function returns the maximum line length necessary to display the
     <cString> text without automatic line breaks.

 Description

     MAXLINE() looks for the longest line within a character string.  This
     allows you to determine the required width for a window to display text
     (MEMO fields).  In this way the text can be displayed without additional
     line breaks.

 Note

     .  With the exception of the carriage return and the line feed,
        this function treats all characters as printable with a width of 1.
        If the <cString> text contains tabs, then you must first use the
        TABEXPAND() function to expand the tabs to spaces.

 Example

     A function, based on the maximum line length, automatically performs a
     suitable call of MEMOEDIT():

     FUNCTION SHOWMEMO(cMemo)

     LOCAL cMessage, nHeight, nWidth

        nHeight   :=  MIN(NUMLINE(cMemo), MAXROW() -1)
        nWidth    :=  MIN(MAXLINE(cMemo), MAXCOL() -1)

        IF nWidth = 0
           cMessage  :=  "The memo field is empty"
        ELSE
           cMessage  :=  ""
           @ 0, 0 TO nHeight +1, nWidth +1 DOUBLE
           MEMOEDIT(cMemo, 1, 1, nHeight, nWidth, .F.)
        ENDIF
        RETURN(cMessage)

See Also: TABEXPAND() NUMLINE()



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.