Calling context sensitive help from a child .chm file

This section is for programmers. Please use it for all discussons on interfacing help with your applications and related subjects.

Moderators: Alexander Halser, Michael Schwarzl

Post Reply
Suda
Posts: 4
Joined: Wed Dec 22, 2004 5:04 pm

Calling context sensitive help from a child .chm file

Unread post by Suda »

H&M Forum
I have one main help file and other is a child help file that is merged at
compile time.

I can call context sensitive help from the application using Help Context
Numbers within the main help file only but if I use a Help Context Number
from a child file, the context sensitive help does not work.

The command I am using is:
Application.HelpCommand(HELP_CONTEXT, ContextID);

Any help would be appreciated.

By the way, when I run the project report for the master help file, the Help Context Numbers from the child help file are not listed.

Suda
User avatar
Tim Green
Site Admin
Posts: 23186
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Calling context sensitive help from a child .chm file

Unread post by Tim Green »

Suda,

You don't say what help format and what kind of context-sensitive help you are using. If you are making calls to context-sensitive topics using dual-mode help (.CHM for the main and .HLP for the context popups) you must generate the necessary .HLP files for the child modules separately, by opening the child modules on their own and compiling them, before you compile the main child modules together with the master module.

If you are using normal HTML Help the problem may be duplicate context numbers between your child and parent modules. Preventing this is something you have to handle yourself: The compiler does not check for these duplicates across modules and will not display error messages when you compile master files together with modules containing duplicate context numbers.

The best way to avoid it is to assign ranges of context numbers for each module. You can reassign all context numbers automatically with different starting numbers by using the Help Context Tool in the Tools menu.
By the way, when I run the project report for the master help file, the Help Context Numbers from the child help file are not listed.
This is normal. The child module in the master module is not actually "there" at design time, it is just a placeholder in the TOC. To generate a report for a child module you must load it for editing (right-click on the blue TOC entry and select Open Child Project).
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Suda
Posts: 4
Joined: Wed Dec 22, 2004 5:04 pm

Unread post by Suda »

Thank you Tim. That did it. I had to create a dual mode hlp file for the child project. Now I have .chm and .hlp file for both the master and the child projects.

Suda
User avatar
Tim Green
Site Admin
Posts: 23186
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Unread post by Tim Green »

Suda,

By the way, you might also want to look at this chapter on including invisible topics in modular projects, it explains some of the potential problems you can encounter and how to deal with them:

http://www.ec-software.com/helphtml/index.html
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Alexander Halser
EC-Software Support
Posts: 4106
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria
Contact:

Unread post by Alexander Halser »

The command I am using is:
Application.HelpCommand(HELP_CONTEXT, ContextID);
Suda,
do you use THelpRouter and CHM files? I suspect something else going on here: with the old HLP files, a topic was a topic and could be displayed either in the main help window or in a popup window. That desicion was made by the application - you could either have displayed it with the command

Code: Select all

Application.HelpCommand(HELP_CONTEXT, ContextID);
or
Application.HelpCommand(HELP_CONTEXTPOPUP, ContextID);
Both still work and THelpRouter translates the help calls accordingly. But the topics in HTML Help are not simply topics. There are HTML encoded topics (which can only be displayed in the regular help viewer window) and text-only topics (which can only be displayed in as small text popups). Both topic types are not compatible and the help call must match the topic type.

Help & Manual by default exports topics with window type "Main" (or with a secondary window type) as HTML encoded topics whereas "Popup" topics are exported as text-only popups.

So if you call the help with Application.HelpCommand(HELP_CONTEXT, 1234); and "1234" points to topic that is marked as "Popup" in Help & Manual, it won't work because that topic was exported as a text-only popup while the command "HELP_CONTEXT" points to a HTML encoded topic to display it in the main help viewer window.

In this case you have two choices:

(a) call the topic with "application.Helpcommand(HELP_CONTEXTPOPUP, 1234)" which results in a tiny text popup or

(b) change the window type of this topic in Help & Manual from "Popup" to "Main", so that it gets exported as a HTML encoded topic which matches the help call.
Alexander Halser
Senior Software Architect, EC Software GmbH
Post Reply