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.
HelpContextID is a property of all of the controls that can gain focus, and it provides the link between the control and its matching Help topic for context-sensitive help. All three of the help engines—DOS, WinHelp and HTML Help—recognize and use the context IDs.
nID = Object.HelpContextID
oObject.HelpContextID = nID
The HelpContextID property is one of the more common among objects, belonging to everything from _SCREEN to option buttons. Use the SYS(1023) and SYS(1024) functions to determine the HelpContextIDs of the forms and buttons on built-in dialogs you want to include in your application.
Menus lack a facility for adding HelpContextIDs to developer-created pads and bars. |
For VFP 6, some, but not all, of the built-in pads lose their context IDs as well. Create a quick menu and run it. Press Shift+F1 and select Edit | Paste from the menu, and Help is gone. SET SYSMENU TO DEFAULT and repeat the steps, and it's back. We suspected at first that only pads relevant to the runtime would have their HelpContextIDs preserved, but that doesn't seem to be the case, either. As we mention in the menu sections, this part of Visual FoxPro is in serious need of an overhaul. This is even more true in VFP 7, where Shift+F1 and selecting any menu item brings up Help, but does not bring up any topic. While we've lost functionality, we can take consolation in the fact that the system menus now behave just like user-defined menus—no context-sensitive help for anybody. |
HelpContextIDs offer a great opportunity for an enterprising third-party developer. Someone could write builders and wizards for quick data entry of context-sensitive help from within the design surfaces, scanning and auditing programs to ensure help file coverage, and automating generation of IDs by scanning projects and their associated files. In fact, someone already has; check out West Wind HTML Help Builder at www.west-wind.com.
HelpContextIDs seem to be limited in range to ±2,147,483,647, but we think that 2^32 separate help topics should be enough for most of our systems.
* We've created a help file where we want a standard
* "this is what happens if you select quit" help topic.
* We've assigned that topic HelpContextID 37 in the HLP file.
* In each of the forms where we want that help, we
* assign the topic to the associated buttons:
oForm.btnQuit.HelpContextID = 37 && Standard 'Quit' help
* Actually, we can do this just once if we make it part of a
* quit button class.