Link to home
Start Free TrialLog in
Avatar of gem56
gem56

asked on

Opening Help using F1 from MDI Form

Hi experts,
I have a problem opening (html) Help from an MDI form using F1, i.e. nothing happens.

From MDI child forms when I press F1 I can open Help but if I close all the child forms and have only the MDI form open if I then press F1 nothing happens.

I've tried setting HelpContextId value to 0 and 1000 (1000 being Introduction topic) but there's no difference.

Any ideas?

     /Michael
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

If nothing will work, you should try to catch the F1 Key in the MDI Main form and try to open the Help from code
ASKER CERTIFIED SOLUTION
Avatar of Preece
Preece
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gem56
gem56

ASKER

Hi angelIII,
I wanted to do that but I'm not aware of how to do that in the MDI form, as it doesn't provide any KeyDown, etc. events.
Do you have a specific example how I can do that?

/Michael
Avatar of gem56

ASKER

Hi Preece,
The link that you provide above seems to go in the same direction as angelIII's suggestion, i.e. trap the F1 key event and manually call HtmlHelp.

As I didn't have to do anything in the first place to map F1 to the Help function I don't know how to change that mapping to the HandleHelpContext function, defined in that link. I know how to "map keys to functions" for normal MDI child forms that provide KeyDown or KeyPress events but if teh Form doesn't provide such events how would you do it then?

Do you know how to do that?

/Michael
Actually, i tried out the code in the link, and it works perfectly

Just take your F1 Help menu mapped to the F1 ShortCut key, open it's Click Event, and put this code in it:

   Call HtmlHelp(Me.hWnd, App.HelpFile, HH_DISPLAY_TOPIC, 0)

Cheers
of course, you need to have the module with the other code also in your project...
If the solution in the link works for you, please be sure to split the points between angelIII and I.  ; - )

Preece
Avatar of gem56

ASKER

Hi guys,
It works 99% the way I'd like it to with one hickup. In my Menu I have two entries for help. The first uses HH_DISPLAY_TOC and the second HH_DISPLAY_SEARCH (which for some reason doesn't work, see my open question (https://www.experts-exchange.com/questions/21477426/Unable-to-open-Help-file-'Search'-tab.html) if  you want some points).

Back to the 1%. How can I map F1 to the module function. Currently I've mapped DISPLAY_SEARCH menu item (using HH_HELP_CONTEXT) but I'd really like to have that go to "Search"tab and have F1 independantly go to the module function. I created another Menu entry and unchecked Visible property but it still appears in the menuBar.

Is there another way of mapping F1 to a function without going via MenuEditor?

/Michael
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial