📄 index.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Help Example</title><link href="style.css" rel="stylesheet" type="text/css"></head><table border="0" width="100%" height="8" bgcolor="#eeeeee"><tr> <td width="100%" height="1"><b><font size="2" color="#000000" face="Arial, Helvetica, sans-serif"><strong><a name=Top></a>S60 3rd Edition SDK FP1 for Symbian OS </strong></font></b><br><i>Example Applications Guide</i></td></tr> </table><!-- Generated by Doxygen 1.4.5 --><div class="tabs"> <ul> <li id="current"><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul></div><h1>Help Example</h1><p><a class="el" href="index.html#Intro_sec">1. About this Example</a> <br><a class="el" href="index.html#UI_sec">2. User Interface</a> <br><a class="el" href="index.html#Design_sec">3. Design and Implementation</a><p><hr><h2><a class="anchor" name="Intro_sec">1. About this Example</a></h2>This SDK example demonstrates how to add support for context sensitive help to an application.<h3><a class="anchor" name="Sub11">1.1 APIs demonstrated</a></h3>The key class of the Help example is TCoeHelpContext. The example also demonstrates the use of functions CCoeControl::GetHelpContext and CCoeAppUi::AppHelpContextL.<p><hr><h3><a class="anchor" name="Sub12">1.2 Prerequisites</a></h3>This example exists as a complete application, and has the standard Symbian OS application architecture, employing the Application, Document, UI, and View classes. The reader should be aware of this structure, along with the following Symbian CS Help Compiler titles, before attempting to understand the example:<p><ul><li>CS Help Guide</li><li>CS Help Compiler GUI Guide</li><li>CS Help Reference</li></ul><p>This example addresses only the enabling of context-sensitive help in applications.<p><hr><h2><a class="anchor" name="UI_sec">2. User Interface</a></h2><div align="center"><img src="image_help01.gif" alt="image_help01.gif"></div><p>The <b>Options</b> menu displays three choices:<p><ul><li>Select <b>Show Form</b> to display an example form.</li><li>Select <b>Help</b> to display help information for the application.</li><li>Select <b>Exit</b> to exit the application.</li></ul><p>On selecting <b>Help</b>, the help application is started and presents application level help. Select <b>Back</b> to return to the example application.<p>Select <b>Show Form</b> from the <b>Options</b> menu to display a form with three editable entries. Navigate to each of the editor windows and invoke the context sensitive help from the <b>Options</b> menu to see how the dialog offers different help depending on which control has input focus.<h2><a class="anchor" name="Design_sec">3. Design and Implementation</a></h2>To provide context sensitive help, applications must first gather context information, then launch the help viewer application, providing it with the gathered context.<p>In the following sections, the Design Overview section provides a design overview of the example.<p>Sections the Requesting application level help section and the Requesting control level help section illustrate the following use case scenarios respectively:<p><ul><li>The user selects <b>Help</b> from the <b>Options</b> menu on the initial HelpExample view. This results in application level help being displayed.</li><li>Having selected the <b>Show Form</b> option, the user now navigates to the desired form entry and selects <b>Help</b> from the <b>Options</b> menu. This results in control level help being displayed.</li></ul><h3><a class="anchor" name="Sub31">3.1 Design Overview</a></h3>The class diagram for this example is shown below:<p><div align="center"><img src="image_help02.jpg" alt="image_help02.jpg"></div><p>To facilitate help in this example, a Help option is added to the <b>Options</b> menu where appropriate. For the form dialog, a menu with a Help option is supplied on form creation. The form dialog creates its own internal menu and adds the supplied menu to it. Menu commands will be sent to the form's ProcessCommandL function when the form is active.<p>For help context gathering, each CCoeControl derived class can override the CCoeControl::GetHelpContext function to return a help context identifier specific to that control. For this example, the <a class="el" href="class_c_helpful_form.html">CHelpfulForm</a> determines which of its form entries has focus and returns help context for that entity.<p>The UI can override the CCoeAppUI::HelpContextL function to provide application level help.<h3><a class="anchor" name="Sub32">3.2 Requesting application level help</a></h3>When the user selects <b>Help</b> from the <b>Options</b> menu on this example's initial view, the following sequence is entered:<p><div align="center"><img src="image_help03.jpg" alt="image_help03.jpg"></div><p><ol type=1><li>The framework passes the ELaunchHelpForContext command to the <a class="el" href="class_c_help_example_app_ui.html#a682d228622cea7790645ce10f591242">CHelpExampleAppUi::HandleCommandL</a> member function.</li><li>The AppUi then calls its inherited function CCoeAppUi::AppHelpContextL.</li><li>CCoeAppUi::AppHelpContextL now gathers an array of help context identifiers by calling the overridden virtual function <a class="el" href="class_c_help_example_app_ui.html#11eeaab9e8b54af05171d9f63abaf4cf">CHelpExampleAppUi::HelpContextL</a>. This returns a help context containing the UID of the help file and a flag indicating that application level help is required, in this case KContextApplication.</li><li>The help application is now passed the gathered array of help contexts by calling HlpLauncher::LaunchHelpApplicationL. This will start the help application if it is not started, or bring it to the front if it is already running.</li></ol><h3><a class="anchor" name="Sub33">3.3 Requesting control level help</a></h3>After the user has selected the <b>Show Form</b> option, navigated to one of the form's controls and selected <b>Help</b> from the form's <b>Options</b> menu, the following sequence is entered:<p><div align="center"><img src="image_help04.jpg" alt="image_help04.jpg"></div><p><ol type=1><li>The framework passes the ELaunchHelpForContext command to the <a class="el" href="class_c_helpful_form.html#418904920ba3cf86d56d138ff3a2a083">CHelpfulForm::ProcessCommandL</a> member function. Note that the form creates its own menu resource resulting in this mechanism being used rather than AppUi's HandleCommandL.</li><li>The ELaunchHelpForContext command is passed back to the <a class="el" href="class_c_help_example_app_ui.html#a682d228622cea7790645ce10f591242">CHelpExampleAppUi::HandleCommandL</a> member function.</li><li>The AppUi then calls its inherited function CCoeAppUi::AppHelpContextL.</li><li>CCoeAppUi::AppHelpContextL now gathers an array of help context identifiers by interrogating any active controls via the CCoeControl::GetHelpContext function.</li><li>For this example, the overridden virtual function <a class="el" href="class_c_helpful_form.html#e972525d2efcc9df7aa10de236a313e3">CHelpfulForm::GetHelpContext</a> is called. This determines which form entry has focus by calling its inherited CEikDialog::IdOfFocusControl function. It then returns a help context containing the UID of the help file and a flag indicating the help required. In this example the first two form entries have specific help (KContextEdwin1 and KContextEdwin2) and any others would give rise to general help for the form (KContextHelpfulForm).</li><li>CCoeAppUi::AppHelpContextL now calls the overridden virtual function <a class="el" href="class_c_help_example_app_ui.html#11eeaab9e8b54af05171d9f63abaf4cf">CHelpExampleAppUi::HelpContextL</a>. This returns a help context containing the UID of the help file and a flag indicating that application level help is required, in this case KContextApplication.</li><li>The help application is now passed the gathered context by calling HlpLauncher::LaunchHelpApplicationL. This will start the help application if it is not started, or bring it to the front if it is already running.</li><li>The base class CAknForm::ProcessCommandL command is now called to completed processing of the menu command (it removes the Options menu from display).</li></ol><p>The help context identifiers KContextApplication and KContextHelpfulView are generated by the Symbian CS Help Compiler and defined in the header file HelpExample.hlp.hrh. See the Symbian CS Help documentation for details of how the corresponding help topics are specified in the source RTF file. <hr><table x-use-null-cells style="x-cell-content-align: top; width: 100%; border-spacing: 0px; border-spacing: 0px;" cellspacing=0 width=100%> <col style="width: 50%;"> <col style="width: 50%;"> <tr style="x-cell-content-align: top;" valign=top> <td style="width: 50%; padding-right: 10px; padding-left: 10px; border-right-style: None; border-left-style: None; border-top-style: None; border-bottom-style: None;" width=50%> <p style="font-family: Arial;"><small style="font-size: smaller;">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -