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.

StatusBar, StatusBarText

These properties control the contents of the status bar. StatusBar is an application property that sends a message to the status bar. StatusBarText lets you specify some text to appear when a control has focus. It’s a cousin to ToolTipText, but more useful for overall data entry. Use StatusBarText to give the user more information about what needs to be entered than the control or its associated label holds. Think of this as the first level of online Help. Like the messages associated with menu items, StatusBarText is there all the time, but is so unobtrusive that it won’t bother the most experienced user.

Usage

oApp.StatusBar = cHelpText
cHelpText = oApp.StatusBar
oObject.StatusBarText = cHelpText
cHelpText = oObject.StatusBarText

StatusBar entered the language in VFP 5 as a property of the Application Object. When you change its value, the new value is displayed on the status bar. But it’s erratic. Lots of things clear it and restore the default value. We haven’t been able to find any rhyme or reason to what changes the status bar and what doesn’t. (In fact, we think the VFP developers have some trouble with this, too, because we’ve seen some pretty strange behavior in development mode. Without doing anything she knows of to cause it and without the mouse positioned over the standard toolbar, Tamar often sees the string “Standard” in the status bar for long periods of time. At other times, the StatusBarText from one of the buttons on that toolbar sticks around, even after the mouse is moved. In both cases, issuing SET STATUSBAR ON reactivates the status bar.)

StatusBarText is a property of individual controls. There’s a gotcha when you enter StatusBarText (and other strings) through the Property Sheet. Don’t surround the text with quotes (yeah, we know it feels unnatural)—if you do, the quotes show up when you run the form. On the other hand, when you assign StatusBarText in code, you do need the quotes. It makes sense (because the Property Sheet, like the Query Designer, is smart enough to figure out what type of data it wants and deal with it appropriately), but it’s really disconcerting with a property as text-oriented as this one.

Grids have StatusBarText, but it appears only when the grid first receives focus and only if you land on a control in the grid that doesn’t have its own StatusBarText. As you move around in the grid, the grid’s StatusBarText does not reappear. You see it again only when focus moves to another control and then back to the grid. We’d like the grid’s StatusBarText to appear anytime focus is on a column whose control doesn’t have any StatusBarText. That would be truly useful. As is, a grid’s StatusBarText seems pretty useless.

Example

* For a Save button, you might set:
This.StatusBarText = " Save the Current Record"

See Also

ErrorMessage, Message, ToolTipText