This is a simple problem, most likely, for most; but not me...

I am trying to enable "What's This" help in a context menu (right click
interface).

I have so far been able to properly code the OnHelpRequested function that
calls when the user clicks the little question mark and then a control on
the
form so that a tooltip pops up and displays useful information regarding the
object under question.

However it does not seem to be so easy to do this from a right click menu.
If it isn't System.EventArgs giving me a hard time its
System.Windows.Forms.HelpEventArgs telling me its incompatible.

EventArgs has no Draw or MousePos definitions.  I have stressed every
possibility that comes to mind.  It could be a simple line of code that I am
missing; or something along the lines of creating a few header files.

I've been plunking away at this for weeks, can anyone lend a hand?
I'll provide a few snipits of code so you can get an idea of what I'm doing.

Thanks =)

~R

------------------------------------


private void InitializeComponent()
       {
[.....]
           //
           // Form1
           //
[.....]
           //Here I handle the overflow for the helpbutton click with a
delegate
           this.HelpRequested += new System.Windows.Forms.HelpEventHandler(
this.OnHelpRequested);

----------------------
/*
The code on the form is as follows
*/

// Handle the Help requested event when the questionmark button is clicked.
       private void OnHelpRequested(object sender,
System.Windows.Forms.HelpEventArgs hlpevent)
       {
           if (Control.MouseButtons != 0)
           // This will show the tooltip help for the "what's this?"
request
           {
               // Gets the control of the mouse position where the user
clicked
               Control ctl = this.GetChildAtPoint(this.PointToClient(
hlpevent.MousePos));
               // Reads the tooltip associated with the control
               string toolTip = this.toolTip1.GetToolTip(ctl);
               // Displays the tooltip, and ensures it doesn't try to
display a blank one
               if (toolTip != "")
                   Help.ShowPopup(ctl, toolTip, hlpevent.MousePos);
               return;
           }
           else
               // If its blank it will bring up the F1 Help, which I
haven't incorporated yet
               //ShowHelpTopicId((int)HelpTopicIds.IDH_DEFAULT);
           // Set flag to show that the Help event as been handled, incase
I get errors
           hlpevent.Handled = true;
       }

/*
I'm trying to make this function do the same
*/

private void whatsThisToolStripMenuItem_Click(object sender, EventArgs e)
       {

       }

/*
Its initialized delegate looks like this
*/

this.whatsThisToolStripMenuItem.Click += new System.EventHandler(
this.whatsThisToolStripMenuItem_Click);
_______________________________________________
coders mailing list
[email protected]
http://lists.slug.org.au/listinfo/coders

Reply via email to