次の方法で共有


WizardBar Context Tracking

OverviewHow Do I

WizardBar passively tracks the current context of the focus in a project. It displays or attempts to display relevant information about the location in which you are currently working in a project.

When you work in a source editor window, WizardBar displays the class or member function in which the cursor is placed. In the source editor, a function effectively begins at the home location (left hand side) of the line on which its definition or declaration begins, and ends with the } end bracket. When the cursor is "between" functions, that is, after an end bracket but before the next function is defined, WizardBar displays the previous function name in a shaded font.

WizardBar also tracks the current context when you work in the dialog editor. WizardBar tracks the class of the selected dialog, or the control ID of the selected control, depending on which is currently active. Double-clicking a dialog control does one of the following:

  • For dialogs that have not yet been associated with a class, ClassWizard appears along with an Adding a Class dialog box, which prompts you to provide a class for the new resource. You can either create a new class or select an existing class.

  • For controls for which a message handler is already implemented, you navigate directly to that handler's definition. (If more than one handler is implemented for the control, you navigate to the first handler in alphanumeric order.)

  • For controls with no handler currently implemented, the Add Member Function dialog box opens. The focus is on the default message for that particular control, for example, BN_CLICKED for a push button. Selecting a message and then OK creates a stub message handler that you can implement later by providing the handler code.

  • For more information about default events for controls, see the Default Controls Event Table.

In other editors, WizardBar does not track, but retains its most recent context displayed in a shaded font.

WizardBar also adjusts its Action menu to include only tasks that make sense within the current context. The Action button has two states: active and inactive. In the active state the button is lit with a yellow document under the wand, to show that the WizardBar can perform some meaningful action. In the inactive state the document disappears, indicating that the WizardBar cannot currently perform a valid action.

The default action, invoked by clicking the Action button, also depends on the current context. It can be "go to function definition," "go to function declaration," or "create new class," depending on the focus. You execute the default action by:

  • clicking the Action button

  • selecting an item in any drop-down list and pressing ENTER

  • selecting a bold item in any drop-down list

  • selecting an element from the Members drop-down list