Search code examples
tabcontroltabpage

HelpProvider and context sensitive help on tab page controls using HelpKeyword and TopicID


I have run into an issue that Google search has failed to solve (or maybe I didn't punch in the magical combination of keywords). Anyway I am having the following problem:

I am creating context sensitive help for my application using the HelpProvider component provided by VS. To create my help files I am using HelpSmith which produces .chm files that have topic and corresponding topic IDs. The idea is that once the HelpProvider.HelpNamespace has been set, I can edit the HelpKeyword and HelpNavigator options from the control properties. This seems to work when I specify that a button's HelpKeyword = 20 and the HelpNavigator = TopicID. I run, click and hold the button and press F1 and my help file opens on the right topic as expected. However I am more interested in context-sensitive help per TabPage control. It seems to work when I click the outer TabControl but not the individual tab pages. Ideally I would like to click the tab where the label is and display help in that way.

Is this possible?

Thanks!


Solution

  • I was just having this problem, it seems that the focus has to be inside the tab page (rather than the tab itself). There may be a nicer solution than this, but this works. It moves the focus to the first control inside the tab when the selected tab index is changed.

        /// <summary>
        /// Moves the focus to the first control on the tab to ensure that the context sensitive help works
        /// </summary>
        private void tabcMaster_SelectedIndexChanged(object sender, EventArgs e)
        {
            SelectNextControl(tabcMaster.SelectedTab,true,true, true, false);
        }