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.

WhatsThisButton, WhatsThisHelp, ShowWhatsThis, WhatsThisHelpID, WhatsThisMode

WhatsThisHelp is a Windows feature meant to serve as an intermediate level of help between ToolTips and the full-fledged Help system. These three properties and two methods control it.

Usage

frmForm.WhatsThisButton = lToShowOrNot
lToShowOrNot = frmForm.WhatsThisButton
frmForm.WhatsThisHelp = lWhichHelpToShow
lWhichHelpToShow = frmForm.WhatsThisHelp
oObject.WhatsThisHelpID = nWTContextID
nWTContextID = oObject.WhatsThisHelpID

Parameter

Value

Meaning

lToShowOrNot

.T.

Display the WhatsThisHelpButton, provided all the other criteria are met. See below for details.

.F.

Don't display the button.

lWhichHelpToShow

.T.

Allows the display of the WhatsThisHelp button on the form's title bar, and allows invoking of the form's ShowWhatsThis and WhatsThisMode methods. When WhatsThisHelp is invoked (through the WhatsThisHelpButton, Shift+F1, or pressing F1 when focus is on an object with a non-zero WhatsThisHelpID), VFP calls the default help file, specified by SET("HELP",1), passing it the WhatsThisHelpID. If the help file is a Windows Help file, WhatsThisHelp appears in a small yellow popup window. If it's HTML or DBF Help, the full help screen is invoked.

.F.

Displays conventional, rather than WhatsThisHelp, help. The form uses the default help file, as indicated by SET("HELP", 1) and passes the context ID specified by the HelpContextID. WhatsThisHelp is disabled. The WhatsThisHelp button does not appear.

nWTContextID

Negative

No WhatsThisHelp is available for this item. When a negative number is sent to the help engine, it displays a message to that effect.

0

When help is requested for oObject, search the container hierarchy, starting with the object and moving through its Parent, then the Parent's Parent, and so forth until a positive ContextID is located. Send the result of the search to the Help engine, which displays that help topic if it's found or the usual "No topic" message if a negative ID is found, but is silent if no non-zero IDs can be located.

Positive

Passes on the ID to the Help engine.

WhatsThisHelp is the little button with the question mark that appears in the titlebar of forms. By design, WhatsThisHelp is available only when the form’s Maximize and Minimize buttons have been disabled, WhatsThisHelp has been set to .T., and the form has a BorderWidth set to any choice other than 0 – No Border. Undocumented is that TitleBar needs to be set .T. also, obviously. We suspect that WhatsThisHelp was originally intended for modal dialogs, where the Help menu was inaccessible, but we have yet to see an interface specification that states that.

When either MaxButton or MinButton (not both) is .T. and all of the other conditions are met, the WhatsThisHelp button appears, shifted a bit to the left, and doesn't work. It shouldn't appear at all.

Usage

oObject.WhatsThisMode( )
PROCEDURE oObject.ShowWhatsThis
LPARAMETERS nWhatsThisHelpID

WhatsThisMode is a method that invokes WhatThisHelp, turning the cursor into a question mark and arrow. Adding NODEFAULT to the method code prevents WhatsThisHelp from starting. Be aware that this is a method, and not a hook to the event occurring. You can call this method to invoke WhatsThisHelp mode, but it doesn’t fire each time WhatsThisHelp is invoked.

ShowWhatsThis is the opposite. It’s called after the context ID has been determined and after the choice of help files has been made. If you want to override the default help display for some controls, you can intercept the ID in this routine and perform the functions you want here. You might, for instance, bring up a custom “help” dialog or a message box. ShowWhatsThis fires if you call WhatsThisHelp with a positive or negative ID and receives the ID, but doesn’t fire if the ID is zero and no non-negative ID can be located in the containership hierarchy.

Example

* Check out the Solutions Sample that comes with VFP
DO HOME(2) + "\Solution\Solution.App"
* Under "Form" select "Provide What's This Help on a Form"

See Also

Help, Set Help, ToolTipText