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?
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~
Hi Kim,
I'll give that a shot... but is there any other way that keeps the code in the Mdi child form? I ask because I have about 20 different Form classes, so I could see this getting messy quite quickly.
Thanks
Andy
Andy,
The issue here is that the child UltraToolbarsManager has no knowledge of tools on the parent UltraToolbarsManager. The only way to keep this code solely in the MDI Child form is to move your PopupMenutool from the parent to the child form.