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()