LogicSmith

Cue Cards

A Bit of Background

The exact design of your cue card help depends on the application. We'll assume for a moment that you have an entry on your application's menu, under Help, named something like Show Cue Cards. Make it toggleable, and you have a nice global variable that can tell you whether to show a cue card or not. This takes care of the ability to turn it off and on. Turning it off is easy - it's just a WinHelp API call with the command HELP_QUIT. Turning it on is harder - it's still just a WinHelp API call but now it needs a topic ID. This is where it gets more complex.

Since your intent is to help the user with what he's doing, you must first know what he's doing if you're to help him. The easiest way to do this is to provide help for whatever has the focus. A control has the focus when it has the focus rectangle, while a window has the focus if any control in it has the focus. Visual Basic comes to the rescue with the ActiveForm and ActiveControl properties. This lets us know what currently has the focus, which lets us solve the above problem of where to start the cue cards.

Since ActiveControl gets us to the focus (in the form of Screen.ActiveForm.ActiveControl), we can examine the properties of this control to see whether it needs a cue card. Under 32-bit Visual Basic, most, if not all, controls have a HelpContextID property, a WhatsThisHelpID property, and a Tag property. The first two contain numeric parameters corresponding to topic ID's, while the last one is a string variable with no predefined purpose. The HelpContextID property is normally used to provide context-sensitive help using the F1 key, but this style of help is seldom used for Windows 95 programs because of the alternative, the WhatsThisHelpID . When enabled, WhatsThis help consists of a new button near the minimize/maximize/exit buttons, containing a question mark. The user would press this button, then press any control on the form for a help popup (sort of like a large tooltip, with the potential for pictures). Since this kind of help should be used instead of the old F1 style, we're free to use the HelpContextID property to point to our cue card topics.

Not all applications need control-specific cue cards, however. Applications with forms that contain lots of controls, for instance, may prefer to have form-level cue cards. Fortunately, we can accomplish this by using the form's HelpContextID field and setting the control's HelpContextID field to zero. But what about those instances where we don't want control or form-level cue cards? For purposes of this article, we'll assume that we have one cue card for the main form that will handle any instance where we don't have a specific cue card. As an "exercise for the student", it would be possible to find a method of selecting a cue card based on certain default settings and/or selected objects.


Copyright © 2009 by Dana Cline
Last Updated  Monday, April 06, 2009
Website hosted by 1and1