Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

SET MEMOWIDTH, Set(“MemoWidth”)

SET MEMOWIDTH lets you specify the number of characters per line for output and processing of memo fields and multiline strings. SET(“MEMOWIDTH”) tells you the current setting.

Usage

SET MEMOWIDTH TO nWidth
? nMemoWidth = SET( "MEMOWIDTH" )

The default memowidth is 50 characters per line. You can set it to anything from 8 to 256, in FP2.x and VFP 3, and 8 to 1024 in later versions. Settings of nWidth less than 8 result in an error message; specifying nWidth more than the maximum allowed gives you the maximum anyway, without an error message.

The memowidth setting affects almost all operations in which memos or character strings are divided into lines. The result of a function like MEMLINES() varies, based on the current setting of memowidth. The following functions and commands are affected by memowidth: ATCLINE(), ATLINE(), RATLINE(), MEMLINES(), MLINE(), ?, ??, DISPLAY, LIST. For ?, ??, DISPLAY and LIST, memowidth affects only memo fields and character strings longer than 256 characters. The other functions apply memowidth to shorter character strings as well. Note that the ALINES() function, added in VFP 6, is not affected by this setting.

SET(“MEMOWIDTH”) lets you determine the current setting for memowidth. Like most of the SET() functions, it’s handy for changing, then restoring the old setting.

Each data session gets its own setting for memowidth.

Example

cLong="This is a long enough string to have some word wrap"
SET MEMOWIDTH TO 20
? MEMLINES(cLong)     && Returns 3
SET MEMOWIDTH TO 50
? MEMLINES(cLong)     && Returns 2
SET MEMOWIDTH TO 256
? MEMLINES(cLong)     && Returns 1

* save old setting
nOldWidth=SET("MEMOWIDTH")
SET MEMOWIDTH TO 80
DISPLAY notes OFF
SET MEMOWIDTH TO nOldWidth

See Also

?, ??, ALines(), AtCLine(), AtLine(), Display and List, MemLines(), MLine(), _MLine, RAtLine(), Set()