[Mono-bugs] [Bug 75700][Nor] New - Child menus not working
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Aug 3 12:00:01 EDT 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by paul at all-the-johnsons.co.uk.
http://bugzilla.ximian.com/show_bug.cgi?id=75700
--- shadow/75700 2005-08-03 12:00:01.000000000 -0400
+++ shadow/75700.tmp.28386 2005-08-03 12:00:01.000000000 -0400
@@ -0,0 +1,131 @@
+Bug#: 75700
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details: FC4
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: paul at all-the-johnsons.co.uk
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Child menus not working
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+Compile and run the source below. If you click on main course, you should
+see a child menu next to "Moo Shu" that says "Pork" and "Vegetarian". It is
+currently not being generated. I've not tested this under .NET as I don't
+have .NET!
+
+Steps to reproduce the problem:
+1. Compile and run the source
+2. Click on "Main Course" or right click for a context menu
+3.
+
+Actual Results:
+The child menu containing "Pork" and "Vegetarian" doesn't appear
+
+Expected Results:
+The child menu should appear
+
+How often does this happen?
+Always
+
+Additional Information:
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+class MenuDemo : Form
+{
+ MenuDemo()
+ {
+ Text = "Menu Demo";
+ MainMenu courseMenu = new MainMenu();
+ MenuItem appetizers = new MenuItem();
+ appetizers.Text = "&Appetizers";
+ MenuItem[] starters = new MenuItem[3];
+ starters[0] = new MenuItem();
+ starters[0].Text = "&Pot stickers";
+ starters[1] = new MenuItem();
+ starters[1].Text = "&Spring rolls";
+ starters[2] = new MenuItem();
+ starters[2].Text = "&Hot && Sour soup";
+ appetizers.MenuItems.AddRange(starters);
+
+ foreach (MenuItem i in starters)
+ i.Click += new EventHandler(OnCombinableMenuSelected);
+
+ MenuItem mainCourse = new MenuItem();
+ mainCourse.Text = "&Main Course";
+ MenuItem[] main = new MenuItem[4];
+ main[0] = new MenuItem();
+ main[0].Text = "&Sweet && Sour Pork";
+ main[1] = new MenuItem();
+ main[1].Text = "&Moo shu";
+ main[2]= new MenuItem();
+ main[2].Text = "&Kung Pao Chicken";
+ main[2].Enabled = false;
+ main[3] = new MenuItem();
+ main[3].Text = "General's Chicken";
+ mainCourse.MenuItems.AddRange(main);
+ foreach (MenuItem i in main)
+ {
+ i.RadioCheck = true;
+ i.Click += new EventHandler(OnExclusiveMenuSelected);
+ }
+
+ MenuItem veg = new MenuItem();
+ veg.Text = "Vegetarian";
+ veg.RadioCheck = true;
+ veg.Click += new EventHandler(OnExclusiveMenuSelected);
+
+ MenuItem pork = new MenuItem();
+ pork.Text = "Pork";
+ pork.RadioCheck = true;
+ pork.Click += new EventHandler(OnExclusiveMenuSelected);
+
+ main[1].MenuItems.AddRange(new MenuItem[] {veg, pork} );
+
+ courseMenu.MenuItems.Add(appetizers);
+ courseMenu.MenuItems.Add(mainCourse);
+
+ ContextMenu contextMenu = new ContextMenu();
+ foreach (MenuItem a in starters)
+ contextMenu.MenuItems.Add(a.CloneMenu());
+ contextMenu.MenuItems.Add(new MenuItem().Text = "-");
+ foreach (MenuItem m in main)
+ contextMenu.MenuItems.Add(m.CloneMenu());
+
+ Menu = courseMenu;
+ ContextMenu = contextMenu;
+ }
+
+ private void OnCombinableMenuSelected(object o, EventArgs ea)
+ {
+ MenuItem selection = (MenuItem) o;
+ selection.Checked = !selection.Checked;
+ }
+
+ private void OnExclusiveMenuSelected(object o, EventArgs ea)
+ {
+ MenuItem selection = (MenuItem) o;
+ bool selectAfterClear = !selection.Checked;
+ Menu parent = selection.Parent;
+ foreach (MenuItem i in parent.MenuItems)
+ i.Checked = false;
+ selection.Checked = selectAfterClear;
+ }
+
+ public static void Main()
+ {
+ Application.Run(new MenuDemo());
+ }
+}
More information about the mono-bugs
mailing list