[Mono-bugs] [Bug 79588][Blo] Changed - [PATCH] ComboBox: ArgumentOutOfRangeException

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Oct 11 20:42:24 EDT 2006


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 alex.olk at googlemail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79588

--- shadow/79588	2006-10-11 20:23:06.000000000 -0400
+++ shadow/79588.tmp.13553	2006-10-11 20:42:24.000000000 -0400
@@ -217,6 +217,52 @@
 "listbox_ctrl.HighlightedIndex = value;" got called value changed to 13.
 
 ------- Additional Comments From alex.olk at googlemail.com  2006-10-11 20:23 -------
 Created an attachment (id=17839)
 new patch
 
+
+------- Additional Comments From alex.olk at googlemail.com  2006-10-11 20:42 -------
+It would be nice if somebody could test that "value" weirdness too.
+
+Replace ComboBox.SelectedIndex with the following version:
+
+public override int SelectedIndex {
+			get { return selected_index; }
+			set {Console.WriteLine("value first time: " + value);
+				if (value <= -2 || value >= Items.Count)
+					throw new ArgumentOutOfRangeException ("Index of out range");
+    				selected_index = value;
+
+    				if (dropdown_style != ComboBoxStyle.DropDownList) {
+					if (value == -1)
+						SetControlText("");
+					else
+						SetControlText (GetItemText (Items [value]));
+    				}
+				
+				Console.WriteLine("value second time: " + value);
+
+    				OnSelectedValueChanged (new EventArgs ());
+    				OnSelectedIndexChanged  (new EventArgs ());
+    				OnSelectedItemChanged (new EventArgs ());
+				if (DropDownStyle == ComboBoxStyle.DropDownList)
+    					Invalidate ();
+
+				Console.WriteLine("value third time: " + value);
+				if (listbox_ctrl != null)
+					listbox_ctrl.HighlightedIndex = value;
+			}
+		}
+
+Now run the FileDialog sample, click the upper "Search in:" ComboBox
+button to get the dropdown listbox and select an item somewhere below
+the currently selected item.
+
+Here I get an ArgumentOutOfRangeException with the following Console
+output:
+
+value first time: 8
+value second time: 8
+value third time: 8
+value third time: 13
+


More information about the mono-bugs mailing list