Symbian
Symbian OS Library

FAQ-0657 How do I implement Context Sensitive Help in my application?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Context Sensitive Help
Created: 06/20/2000 Modified: 09/01/2004
Number: FAQ-0657
Platform: Symbian OS v6.0, Symbian OS v6.1

Question:
As the author of a Symbian OS C++ application, how do I implement hooks in my application so that context sentsitive help can be used?
Note that there is more information on this topic available in the 6.0 and 6.1 SDKs.


Answer:
1. Identify the dialogs and views for which you wish to have context sensitivity.
2. Using the context sensitive help compiler, cshlpcmp, compile a framework help file that contains the topic titles and context sensitive hooks.

A header file is produced containing descriptors created from the contexts defined by the help author and a comment, e.g.:

_LIT(KMAI_HLP_VIEW_MAIN_EDITOR,"MAI HLP VIEW MAIN EDITOR"); //the main view of the Mail Editor application

3. #include header file in app
4. For each context, identify whether it is a dialog or a view.
5. If the context is on the control stack (i.e. a dialog) implement GetHelpContext() - override the virtual function in class CCoeControl in Cone, e.g. :

void CMsgMailSendOptionsDialog::GetHelpContext(TCoeHelpContext& aContext)
{
aContext.iMajor = KUidMsgMailEditorApp; //Uid of app
aContext.iContext = KMAI_HLP_PAGE_MESSAGE_OPTIONS;
                          //Context string from header file }

                          Use switch cases for multipage dialogs with different contexts, e.g.:

                          switch (ActivePageId())
                          {
                          case EDlgPageOne:
                          aContext.iContext = KCAL_HLP_DIAL_FIND_OPTIONS;
                          break;
                          case EDlgPageTwo
                          aContext.iContext = KCAL_HLP_DIAL_REPEAT_OPTIONS;
                          break;
                          //other cases....
                          }

                          Note that high priority invisible controls and FEPs are not suitable to be given contexts.

                          6. If the context is not on the control stack (i.e. a view) implement HelpContextL() - override the virtual function in class CCoeAppUi in Cone:

                          CArrayFix* CWordAppUi::HelpContextL() const
                              {
                              CArrayFix* r = new(ELeave) CArrayFixFlat(1); CleanupStack::PushL(r);
                              r->AppendL(TCoeHelpContext(KUidWordAppValue, KTXT_HLP_VIEW_MAIN()));
                              CleanupStack::Pop(); // r
                              return r;
                              }