Delphi 7 Help display problem

When I assign a help file and help context to a menu item in my program, the correct help screen is not displayed when F1 is pressed.

It will display the first help item in the help file contents no matter which menu item you were on when you pressed F1.
Also, a small popup box is dispayed on the screen with the title of the correct help item topic name and it appears to be independent of the help screen and must be closed separately.

This only happens when I use a tmainmenu object. In my forms and other places, help works fine. Except there is a significant delay in the display of the help of about 3 to 4 seconds. It is long enough to were you wonder if you pressed the F1 key. This happens with all help calls anywhere in the application.

I have experimented in the Delphi IDE to see if I could get an idea of where the problem was. I found that when you bring up Delphi without any files open at all and press F1 on a pull-down menu. It will displays the help for the main menu item of that group. The pull-down menu is also closed when the help appears.

I have tried other applications (projects) and installed Delphi 7 on other computers, and I get the same results.

I would like to know:

1) how to make help work correctly in a tmainmenu object. Or if I cannot, what other menu object will work correctly.

2) how to make the screen screen come up immediately as it does in other Windows based programs.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Can I see your code please (to see how you are doing this).
I have an idea, but am unsure as to how you have implemented. (There is more than 1 way)


pmacblAuthor Commented:
I am simply using the forms helpfile and helpcontext properties and the F1 key to call the help. There is no code involved on my end.
hi pmacbl

I am sorry, I cannot re-produce your described problems.
I have tried numerous ways, and only get it to show the correct help-context id.

Plz post ur form and unit code.

As for the delay with opening the helpfile, I can find no good solution at the moment.

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Application.HelpFile :=Your Application Path+'\'+'YourHelpFile.hlp';
Application.HelpCommand(HELP_FINDER, 0);

Your help file extension depends on the help you use it can be chm also.

I can't seem to solve the problem of the help file loading slowly, but I seem to have solved your menu problem.

Application.HelpCommand(HELP_FINDER, 0); <-- This is the problem line....

The entire thing works if you take this out...
All my menus goto the correct place in the help file.

Description of problem:
Helpcommand is defined as follows

function HelpCommand(Command: Word; Data: Longint): Boolean;

Now, the Data is where the index your program is looking for in the help file goes, but you have assigned it to zero.
Delphi 7 automatically picks up the helpcontext from the menuitem, if you leave this line out.  Otherwise you may have to determine which item the mouse is over, pick up its helpcontext and pass it into this function.

Hope this fixes your problem...

pmacblAuthor Commented:
No that did not resolve my problem.

I did find this information that tells me it is possibly a bug in Delphi 6 - 7.

Delphi 6 and above broke the OnHelp event which we rely on to override the Delphi WinHelp system (you will notice the some help events no longer fire). Please make sure you download "Delphi Example 12" which includes a fix file (D6OnHelpFix.pas). All you need to do is include the D6OnHelpFix.pas unit anywhere in your project and all help events will then fire as they did in Delphi 3/4/5.

I did not find anything that addresses the delay of the help displaying.

PAQed with points refunded (250)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.