Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1130
How to catch menu opening?
posted

Hi,

I have an UltraToolbarsManager on my main form, and on an MDI child form as well.  On the main menu, i have an Edit PopupTool, and on the child form I add items to the Edit popup.  i want to run some code (in the MDI child) every time the Edit menu is open, but I can't figure out how to do that.  When PopupTools which are added as part of the child are opened, the BeforeToolDropdown is fired, but not when edit is opened.

Any ideas?

Parents
  • 5389
    Suggested Answer
    posted

    ajj3085,

    The BeforeDropDown event will not fire in the child form if a PopupMenuTool that was created on the MdiParent was dropped down.  What you can do is create an internal method in your child form and handle the BeforeDropDown event on the MdiParent form.  In that event get the instance of your MdiChild and call your internal method.  Code might look something like:

    In the MdiChild:

            internal void MyMethod()
            {
                // Do something here
            }

    In the MdiParent:

            private void ultraToolbarsManager1_BeforeToolDropdown(object sender, Infragistics.Win.UltraWinToolbars.BeforeToolDropdownEventArgs e)
            {
                if (e.Tool.Key == "PopupMenuTool1")
                {
                    Form1 f = (Form1)this.MdiChildren[0];
                    f.MyMethod();
                }
            }

    Hope this helps,

    ~Kim~

Reply Children