Finding the menu item the mouse is over for help request [modified]
-
I want to have my compiled html help point to a topic specific to where the mouse is pointing 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 and not the item the mouse is over. Hope someone can help :sigh:
Programmer Glenn Earl Graham Austin, TX
modified on Friday, January 04, 2008 1:56:26 PM
-
I want to have my compiled html help point to a topic specific to where the mouse is pointing 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 and not the item the mouse is over. Hope someone can help :sigh:
Programmer Glenn Earl Graham Austin, TX
modified on Friday, January 04, 2008 1:56:26 PM
Hi, have a look at the sender parameter, I expect it to hold the current control; the only thing required typically is a cast. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Happy 2008!
-
Hi, have a look at the sender parameter, I expect it to hold the current control; the only thing required typically is a cast. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Happy 2008!
It does not. The control is the form not the menu item. I have updated my code. Thanks for the suggestion. :sigh: :((
Programmer Glenn Earl Graham Austin, TX
-
It does not. The control is the form not the menu item. I have updated my code. Thanks for the suggestion. :sigh: :((
Programmer Glenn Earl Graham Austin, TX
Hi Glenn, that's too bad, I don't know then. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Happy 2008!