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 MESSAGE, Set(“Message”)

SET MESSAGE controls the location of messages coming from menus and old-style controls (@ … GET and @ … EDIT). It also lets you explicitly specify a message. This one got weird in the move to Windows and hasn’t gotten any better in Visual FoxPro.

Usage

SET MESSAGE TO cMessage
SET MESSAGE TO nRow [ LEFT | CENTER | RIGHT ]
SET MESSAGE WINDOW MessageWindow
nMessageRow = SET( "MESSAGE" )
cMessage = SET( "MESSAGE", 1 )

SET MESSAGE is pretty wimpy in Visual FoxPro. This set of commands was quite handy in FoxPro for DOS, where it gave you lots of control over the messages associated with input controls and menu items and even let you show a message totally unrelated to screens or menus. But something was lost in the translation to Windows.

SET MESSAGE WINDOW is ignored in Visual FoxPro or in FoxPro 2.x for Windows. Messages still appear in the Windows-style status bar. If you turn that off, too, your messages go straight to oblivion.

SETting MESSAGE to a particular row works only when you have the Xbase-style status bar turned on. That's the one controlled by SET STATUS, not the Windows-type bar controlled by SET STATUS BAR.

SET(“MESSAGE”) returns only the row to which MESSAGE has been set. When you SET MESSAGE to a window, there’s nothing that lets you know that. Interestingly, when MESSAGE is set to the Windows-style status bar, the row returned appears to reflect the bar’s position. If you resize the main VFP window, the value returned changes.

Fortunately, none of the problems here is that severe because good Windows applications put their messages in the Windows-style status bar, not in miscellaneous windows or random locations on screen. Plus, the StatusBarText property is a much easier way to associate some text with each object. If what you’re really trying to do is give controls those neat little messages that all recent Microsoft applications have, take a look at the ToolTips and ItemTips properties. If you want to throw system messages on the screen, use MESSAGEBOX().

See Also

ItemTips, MessageBox(), Set, StatusBarText, ToolTipText