CHM TABs Search, TOC etc

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

CHM TABs Search, TOC etc

Unread postby alanmcd » Wed Jul 03, 2019 7:09 pm

Is there a way of forcing the CHM file to open on a specific tab? It remembers what tab you were on and so when you close it while on the Index Tab, then try to show a context page, the context page opens but the tab is still on the Index page. I'd like to force open it on the contents tab with my context highlighted.
Alan
alanmcd
 
Posts: 91
Joined: Thu Jan 06, 2005 3:02 pm

Re: CHM TABs Search, TOC etc

Unread postby Alexander Halser » Thu Jul 04, 2019 7:40 am

Is there a way of forcing the CHM file to open on a specific tab?


Yes, there is. When you open the help of Help+Manual (click on the Help button in a dialog box, as this opens a context-sensitive help page) you will notice that the help window always switches back to the TOC tab. The synchronization between topic and TOC is done automatically by the CHM viewer, but the tab switching is done by Help+Manual in the internal help call.

For general help display we use this help call:
Code: Select all
HtmlHelp(0, strHelpFile, HH_DISPLAY_TOC, 0);


For context-sensitive help in a dialog, we display the TOC first, then open the context topic:
Code: Select all
HtmlHelp(0, strHelpFile, HH_DISPLAY_TOC, 0);
HtmlHelp(0, strHelpFile, HH_HELP_CONTEXT, intContextMapNumber);


You can also force a specific tab to open:
Code: Select all
HtmlHelp(0, strHelpFile, HH_DISPLAY_TOC, 0);   //open help and switch to TOC
HtmlHelp(0, strHelpFile, HH_DISPLAY_INDEX, 0);   //switch to keyword index
HtmlHelp(0, strHelpFile, HH_DISPLAY_SEARCH, 0);  //switch to search tab
Alexander Halser
Senior Software Architect, EC Software GmbH
User avatar
Alexander Halser
EC-Software Support
 
Posts: 3940
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria

Re: CHM TABs Search, TOC etc

Unread postby alanmcd » Thu Jul 04, 2019 2:09 pm

Thanks Alexander. I seem to have used
Application.HelpSystem.ShowContextHelp
and
Application.HelpCommand
alanmcd
 
Posts: 91
Joined: Thu Jan 06, 2005 3:02 pm

Re: CHM TABs Search, TOC etc

Unread postby Alexander Halser » Thu Jul 04, 2019 2:45 pm

If it is Delphi and you are using Vcl.HtmlHelpViewer to invoke HTML Help, you need to do it differently.

The unit Vcl.HtmlHelpViewer encapsulates the HtmlHelp() Windows API and you cannot use the Windows API call directly. If you do, especially if you call it with the first paramater "0" (zero, that's the window handle), it will very likely generate an AV. You need to use the same handle in the HtmlHelp() call that the VCL has used to initialize the API. But you cannot easily get to this handle.

The workaround is to let Delphi handle all the application help calls and strictly use Application.HelpCommand().

Example:
Code: Select all
Application.HelpCommand(HELP_FINDER, 0);   //opens the help file and shows TOC
Application.HelpCommand(HELP_CONTEXT, intContextNumber);

//Instead of HELP_CONTEXT you can alternatively use:
//Application.HelpSystem.ShowContextHelp()
Alexander Halser
Senior Software Architect, EC Software GmbH
User avatar
Alexander Halser
EC-Software Support
 
Posts: 3940
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria

Re: CHM TABs Search, TOC etc

Unread postby alanmcd » Sat Jul 06, 2019 7:20 am

So in Delphi 7 which doesn't have HTMLHelpViewer, what is the way to force the search tab to open?
HELP_PARTIALKEY brings up the Index Tab
HELP_FINDER and HELP_CONTENTS both bring up the TOC
HELP_HELPONHELP does nothing
HELP_CONTEXT works OK but (brings up teh conxt topic but doesn;t switch back to TOC

I'd like to force the search tab
and also force the switch back to TOC when opening a context ID

Alan
alanmcd
 
Posts: 91
Joined: Thu Jan 06, 2005 3:02 pm

Re: CHM TABs Search, TOC etc

Unread postby Alexander Halser » Sat Jul 06, 2019 9:05 am

what is the way to force the search tab to open?


It should be:
HH_DISPLAY_TOC (const int = 1) = show TOC tab
HH_DISPLAY_INDEX (const int = 2) = show index tab
HH_DISPLAY_SEARCH (const int = 3) = show search tab

I vaguely remember that the search tab had a few quirks. Looking up an index keyword worked, but looking up a search term through the API never did.

HELP_CONTEXT works OK but (brings up teh conxt topic but doesn;t switch back to TOC

Call HH_DISPLAY_TOC before HELP_CONTEXT. It's 2 help calls in this case.
Alexander Halser
Senior Software Architect, EC Software GmbH
User avatar
Alexander Halser
EC-Software Support
 
Posts: 3940
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria


Return to Help & Manual 7 Forum

Who is online

Users browsing this forum: Google [Bot] and 10 guests