Author: calberto
Date: 2007-12-13 19:50:10 -0500 (Thu, 13 Dec 2007)
New Revision: 91263
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
Log:
2007-12-13 Carlos Alberto Cortez <[EMAIL PROTECTED]>
* ListBox.cs: If we remove the item currently selected,
remove it not only from SelectedItems, but also
resetting selected_index. Moreover, set focused_item to Items.Count - 1
if
the items count decreased and focused_item has bigger value than that.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-12-14 00:31:16 UTC (rev 91262)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-12-14 00:50:10 UTC (rev 91263)
@@ -1,3 +1,10 @@
+2007-12-13 Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+ * ListBox.cs: If we remove the item currently selected,
+ remove it not only from SelectedItems, but also
+ resetting selected_index. Moreover, set focused_item to Items.Count - 1
if
+ the items count decreased and focused_item has bigger value than that.
+
2007-12-13 Jonathan Pobst <[EMAIL PROTECTED]>
* Control.cs: Perform our layout after we resize ourselves
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
2007-12-14 00:31:16 UTC (rev 91262)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
2007-12-14 00:50:10 UTC (rev 91263)
@@ -2011,13 +2011,15 @@
{
if (sorted)
Sort (false);
-
+
if (Items.Count == 0) {
selected_index = -1;
focused_item = -1;
top_index = 0;
}
-
+ if (Items.Count <= focused_item)
+ focused_item = Items.Count - 1;
+
if (!IsHandleCreated || suspend_layout)
return;
@@ -2475,6 +2477,8 @@
if (index < 0 || index >= Count)
throw new ArgumentOutOfRangeException
("Index of out range");
+ if (index == owner.selected_index)
+ owner.selected_index = -1;
owner.selection.Remove (object_items [index]);
object_items.RemoveAt (index);
owner.CollectionChanged ();
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches