Our existing help (.HLP) is very outdated and we do not have the source, context references, etc and so we are re-writing the help in CHM format and are under a tight deadline and so we are not putting in any form/field context numbers or trying to match any existing context numbers. All we want to do is show a help file with the TOC showing on the left and the main page on the right. Nothing fancy.
Problem:
We have a "child" form that is the base for most of the forms in our application. This child form has a set of buttons (TbitBtn), one of which triggers the showing of our help file (see below)
Code: Select all
procedure TfrmMXTChild.btbtnHelpClick(Sender: TObject);
begin
frmMXTMain.hrHelp.Helpfile := Application.HelpFile;
frmMXTMain.hrHelp.HelpType := htHTMLhelp;
frmMXTMain.hrHelp.HelpContent;
end;
This works great on most of the forms but there are several that ignored the btbtnHelpClick event (put a breakpoint on the first line of the event and it was never triggered). We verified that the troublesome form was inheriting from frmChild, that the button events were associated, etc. We finally discovered the one difference between the forms that work and the forms that don't work. The form HelpContext on frmChild is = 0 and on all the inherited forms that don't work, the HelpContext was changed to a non-zero value (all positive numbers so far) and on the inherited forms that do show the help file the HelpContext is = 0. I was able to work around the issue by adding the following code to the frmChild.FormCreate event
Code: Select all
if self.HelpContext <> 0 then
self.HelpContext := 0;
My question is why is the btbtnHelp's OnClick event being bypassed when the HelpContext on the form is something other than zero?
Thanks
Rick Anderson