Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. Finding the menu item the mouse is over for help request

Finding the menu item the mouse is over for help request

Scheduled Pinned Locked Moved Windows Forms
c++htmlwinformshelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    earlgraham
    wrote on last edited by
    #1

    I am working in C++/CLI with Windows Forms and I want to have my compiled html help point to a topic specific to where the mouse is pointing (like as a menu item) but I can't seem to determine which control the mouse is hovering over.

    private: System::Void FrmMain_HelpRequested(System::Object^ sender, System::Windows::Forms::HelpEventArgs^ hlpevent)
    {
    Point pt = this->PointToClient(hlpevent->MousePos);
    Control^ requestingControl = dynamic_cast(sender);
    Control ^ctrl = this->GetChildAtPoint(pt);
    Control ^ctrl2 = this->ActiveControl;
    if( File::Exists(this->helpProvider->HelpNamespace ) == true)
    {
    Help::ShowHelp(this, this->helpProvider->HelpNamespace);
    }
    }

    ctrl is the form itself and crtl2 is the last active mdichild in my application. requestingControl returns the form (same as ctrl)and not the item the mouse is over. Hope someone can help :sigh:

    Programmer Glenn Earl Graham Austin, TX

    K 1 Reply Last reply
    0
    • E earlgraham

      I am working in C++/CLI with Windows Forms and I want to have my compiled html help point to a topic specific to where the mouse is pointing (like as a menu item) but I can't seem to determine which control the mouse is hovering over.

      private: System::Void FrmMain_HelpRequested(System::Object^ sender, System::Windows::Forms::HelpEventArgs^ hlpevent)
      {
      Point pt = this->PointToClient(hlpevent->MousePos);
      Control^ requestingControl = dynamic_cast(sender);
      Control ^ctrl = this->GetChildAtPoint(pt);
      Control ^ctrl2 = this->ActiveControl;
      if( File::Exists(this->helpProvider->HelpNamespace ) == true)
      {
      Help::ShowHelp(this, this->helpProvider->HelpNamespace);
      }
      }

      ctrl is the form itself and crtl2 is the last active mdichild in my application. requestingControl returns the form (same as ctrl)and not the item the mouse is over. Hope someone can help :sigh:

      Programmer Glenn Earl Graham Austin, TX

      K Offline
      K Offline
      Kschuler
      wrote on last edited by
      #2

      I work in vb.net, and each control has it's own Help_Requested event...which fires when you click on the control (the textbox or label or whatever...) while you have the help mode activated. Perhaps it is similar in your language. Hope this helps.

      E 1 Reply Last reply
      0
      • K Kschuler

        I work in vb.net, and each control has it's own Help_Requested event...which fires when you click on the control (the textbox or label or whatever...) while you have the help mode activated. Perhaps it is similar in your language. Hope this helps.

        E Offline
        E Offline
        earlgraham
        wrote on last edited by
        #3

        Got worked out. Here is my final code.

        for each ( ToolStripMenuItem ^tmpMS in this->menuMainForm->Items )
        {
        for each ( ToolStripItem ^tmpCntl in tmpMS->DropDownItems )
        {
        if (tmpCntl)
        {
        if ( tmpCntl->Selected )
        String ^tmpCntlName = tmpCntl->Name;
        OpenHelpForMenuItem(tmpCntlName);
        }
        }
        }

        Programmer Glenn Earl Graham Austin, TX

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups