Delphi 7 Help display problem

Posted on 2006-04-21
Last Modified: 2010-04-05
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.

Question by:pmacbl
    LVL 2

    Expert Comment

    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)



    Author Comment

    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.
    LVL 2

    Expert Comment

    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.


    Expert Comment

    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.
    LVL 2

    Expert Comment


    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...


    Author Comment

    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.


    Accepted Solution

    PAQed with points refunded (250)

    Community Support Moderator

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now