11.04.2014 Views

Advanced MFC Programming

Advanced MFC Programming

Advanced MFC Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 16. Context Sensitive Help<br />

The edit box and radio button still use the default style, whose help window contains standard menu<br />

and buttons. The help windows of push button and combo box controls are implemented by pop up<br />

window, which is a smaller window with a yellowish background, and does not contain other controls<br />

(Figure 16-10). By passing different parameters to function CWinApp::WinHelp(…), we can activate “Help<br />

Topic” dialog box. Also, we can adjust its position and size of the help window before it is displayed,.<br />

Display help in a<br />

pop up window<br />

Figure 16-10. Pop up Help Window<br />

Summary<br />

1) In order to implement context sensitive help for a command, we need to add a footnote to the<br />

“AfxCore.rtf” file, then link the command ID to the tag of the footnote.<br />

2) Usually the help ID is generated by prefixing character(s) to the resource ID of the command, and the<br />

value of the help ID is generated by adding a fixed number to the value of the resource ID.<br />

3) The resource ID can be linked to a footnote tag by specifying an alias name in “.hpj” file.<br />

4) A help page can be referenced either from other help pages or from the application.<br />

5) To support context sensitive help in the dialog box, we need to call function CWnd::<br />

SetWindowContextHelpId(…) for every common control that will support context sensitive help, and<br />

override function CWnd::OnHelpInfo(…) to activate customized help window.<br />

6) By default, function CWnd::OnHelpInfo(…) does not support context sensitive help for common<br />

controls. In this case, we can call CWinApp::WinHelp(…) to customize the default help implementation.<br />

7) When calling function CWinApp::WinHelp(…), we can use various parameters to activate help windows<br />

in different styles. For example, using parameter HELP_CONTEXTPOPUP will invoke a pop up help<br />

window.<br />

490

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!