Author: calberto
Date: 2007-12-12 20:02:09 -0500 (Wed, 12 Dec 2007)
New Revision: 91191

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-12  Carlos Alberto Cortez <[EMAIL PROTECTED]>

        * ListBox.cs: Add the internal overload Sort (bool paint),
        to indicate whether we actually need a paint or we will
        call Refresh ourselves. This way we don't request a paint
        _before_ having an updated and valid layout.
        Fixes #347233.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-12-13 00:01:43 UTC (rev 91190)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-12-13 01:02:09 UTC (rev 91191)
@@ -1,3 +1,11 @@
+2007-12-12  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+       * ListBox.cs: Add the internal overload Sort (bool paint),
+       to indicate whether we actually need a paint or we will
+       call Refresh ourselves. This way we don't request a paint
+       _before_ having an updated and valid layout.
+       Fixes #347233.
+
 2007-12-12  Andreia Gaita <[EMAIL PROTECTED]>
 
        * XPlatUIX11.cs: Send paint messages when updating a systray icon

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-13 00:01:43 UTC (rev 91190)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs       
2007-12-13 01:02:09 UTC (rev 91191)
@@ -1118,11 +1118,22 @@
 
                protected virtual void Sort ()
                {
+                       Sort (true);
+               }
+
+               //
+               // Sometimes we could need to Sort, and request a Refresh
+               // in a different place, to not have the painting done twice
+               //
+               void Sort (bool paint)
+               {
                        if (Items.Count == 0)
                                return;
 
                        Items.Sort ();
-                       base.Refresh ();
+
+                       if (paint)
+                               base.Refresh ();
                }
 
                public override string ToString ()
@@ -1999,7 +2010,7 @@
                internal virtual void CollectionChanged ()
                {
                        if (sorted) 
-                               Sort ();
+                               Sort (false);
                        
                        if (Items.Count == 0) {
                                selected_index = -1;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to