Finding the menu item the mouse is over for help request
-
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
-
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
-
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.
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