DEFINE MENU

ShowTips, ToolTipText

We really love tooltips—they're the little messages that appear when you pause over a toolbar button in almost any Windows app that's been released in the last few years. (We especially love them because we often can't tell what a lot of the icons are meant to be.) On the other hand, occasionally they get in our way. So, we think this pair of properties is really cool. ToolTipText lets you specify tooltips for pretty much any native control. ShowTips determines, on a form-wide basis, whether the messages show.

Usage

oObject.ShowTips = lShowTips lShowTips = oObject.ShowTips oObject.ToolTipText = cToolTipMessage cToolTipMessage = oObject.ToolTipText
All the native controls that accept focus plus shapes let you specify tooltips. However, when you embed a control in a grid, the only time the tooltip shows is when that control actually has focus and you pause the mouse there. Since we're not really convinced you'd ever want tooltips in a grid (see below), we don't think this is too much of a limitation.

Tooltips are limited to 50 characters in VFP 3 and 127 in later versions. In VFP 3, you can specify a longer tip, but nothing at all shows up for that control. In VFP 5 and later, you can't specify a tip that's too long—you get an error message. The length restriction, especially at 127, isn't so limiting—these are just meant to be quick reminders of a control's functions, not full-blown help. If you want to specify something longer than that, consider using StatusBarText, which lets you put a message in the status bar when the control has focus, or WhatsThisHelp. One hundred and twenty-seven characters in a little yellow ribbon across the screen is unreadable, annoying and amateurish.

Only forms and toolbars have the ShowTips property because they're an all-or-nothing proposition. The default is different, though, for the two types of objects. By default, forms have tooltips off while toolbars have them on.

The defaults pretty much match our view of when to use tooltips. Controls in toolbars should have them. Most items in forms should not. One way to look at it is that "tools" should have tooltips. Another view, and the one we feel most comfortable with, is that controls that present only an icon to the world should have tooltips. Textual controls like an "OK" button don't need a tooltip—if "OK" isn't clear enough, use a different prompt.

Every rule has its exception, and this one does, too. While it is not difficult to design forms with separate toolbars, there are still a number of developers who prefer their tools to be embedded in their forms. Witness the "Next," "Previous," "Top" button bar embedded in the standard Form Wizard-generated form, or the control panel of buttons at the top of the Class Browser. Both have ShowTips on by default (actually, the Wizard form does that only if you choose picture buttons), and we cannot argue with that choice. As always, with user interface issues, establish a standard for your applications and stick with it.

Don't confuse tooltips with the little tips that pop up when you can't see all of an entry in a list box. Those are ItemTips.

Example

ThisForm.cmdQuit.ToolTipText = "Exit this application" ThisForm.cmdSave.ToolTipText = "Save current record" ThisForm.ShowTips = .T.

See Also

ItemTips, StatusBarText, WhatsThisHelp


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net