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.

AddLineFeeds

This property was added in VFP 6 Service Pack 3 to address an issue in manipulating edit box data. It allows you to specify whether return characters (CHR(13)) automatically turn into return plus linefeed (CHR(13) + CHR(10)) when edit box data is moved to its ControlSource.

Usage

edtEditBox.AddLineFeeds = lAddLineFeeds
lAddLineFeeds = edtEditBox.AddLineFeeds

In older versions of VFP and by default in recent ones, whenever the value of an edit box is moved to its ControlSource and whenever the edit box loses focus, a linefeed character is added to follow each return character (one per return—they don’t keep accumulating). This ensures that the data will display correctly in pretty much any application, since some like CHR(13), others like CHR(10), and some require both.

However, when you add the linefeed character, it fouls up operations involving LEN() and other position-based values, like SelStart and SelLength. (For example, you might be setting SelStart and SelLength to highlight particular data in the edit box. When the linefeed is added, your positions are off.) Microsoft heard our entreaties on this front, and added this property, which allows us to just say no to linefeeds.

Example

* You're most likely to set this one in the Property Sheet
* but, if it were code, you'd do something like:
This.AddLineFeeds = .F.

See Also

Chr(), EditBox, Len(), SelLength, SelStart