[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-patches
Subject: [Mono-patches] r154567 -
From: "Carlos Alberto Cortes (calberto.cortez () gmail ! com)"
Date: 2010-03-31 17:58:37
Message-ID: 20100331175837.A867326064 () mono-cvs ! ximian ! com
[Download RAW message or body]
Author: calberto
Date: 2010-03-31 13:58:37 -0400 (Wed, 31 Mar 2010)
New Revision: 154567
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
Log:
2010-03-31 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* ListView.cs: Selection should be available after the first time the
handle has been created, even if later the handle is destroyed or
temporary invalidated.
Fixes #584070.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 2010-03-31 \
17:51:34 UTC (rev 154566)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 2010-03-31 \
17:58:37 UTC (rev 154567) @@ -1,3 +1,10 @@
+2010-03-31 Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+ * ListView.cs: Selection should be available after the first time the
+ handle has been created, even if later the handle is destroyed or
+ temporary invalidated.
+ Fixes #584070.
+
2010-03-01 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* TreeView.cs: When receiving a double click on a node, toggle it only
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs 2010-03-31 \
17:51:34 UTC (rev 154566)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs 2010-03-31 \
17:58:37 UTC (rev 154567) @@ -113,6 +113,9 @@
private int virtual_list_size;
private bool right_to_left_layout;
#endif
+ // selection is available after the first time the handle is created, *even* if \
later + // the handle is either recreated or destroyed - so keep this info around.
+ private bool is_selection_available;
// internal variables
internal ImageList large_image_list;
@@ -1207,7 +1210,7 @@
internal void OnSelectedIndexChanged ()
{
- if (IsHandleCreated)
+ if (is_selection_available)
OnSelectedIndexChanged (EventArgs.Empty);
}
@@ -3506,6 +3509,7 @@
protected override void CreateHandle ()
{
base.CreateHandle ();
+ is_selection_available = true;
for (int i = 0; i < SelectedItems.Count; i++)
OnSelectedIndexChanged (EventArgs.Empty);
}
@@ -5901,7 +5905,7 @@
[Browsable (false)]
public int Count {
get {
- if (!owner.IsHandleCreated)
+ if (!owner.is_selection_available)
return 0;
return List.Count;
@@ -5920,7 +5924,7 @@
public int this [int index] {
get {
- if (!owner.IsHandleCreated || index < 0 || index >= List.Count)
+ if (!owner.is_selection_available || index < 0 || index >= List.Count)
throw new ArgumentOutOfRangeException ("index");
return (int) List [index];
@@ -5958,12 +5962,12 @@
if (itemIndex < 0 || itemIndex >= owner.Items.Count)
throw new ArgumentOutOfRangeException ("index");
- if (owner.virtual_mode && !owner.IsHandleCreated)
+ if (owner.virtual_mode && !owner.is_selection_available)
return -1;
owner.Items [itemIndex].Selected = true;
- if (!owner.IsHandleCreated)
+ if (!owner.is_selection_available)
return 0;
return List.Count;
@@ -5977,7 +5981,7 @@
#endif
void Clear ()
{
- if (!owner.IsHandleCreated)
+ if (!owner.is_selection_available)
return;
int [] indexes = (int []) List.ToArray (typeof (int));
@@ -6041,7 +6045,7 @@
public int IndexOf (int selectedIndex)
{
- if (!owner.IsHandleCreated)
+ if (!owner.is_selection_available)
return -1;
return List.IndexOf (selectedIndex);
@@ -6145,7 +6149,7 @@
public ListViewItem this [int index] {
get {
- if (!owner.IsHandleCreated || index < 0 || index >= Count)
+ if (!owner.is_selection_available || index < 0 || index >= Count)
throw new ArgumentOutOfRangeException ("index");
int item_index = owner.SelectedIndices [index];
@@ -6203,7 +6207,7 @@
public void CopyTo (Array dest, int index)
{
- if (!owner.IsHandleCreated)
+ if (!owner.is_selection_available)
return;
if (index > Count) // Throws ArgumentException instead of IOOR exception
throw new ArgumentException ("index");
@@ -6214,7 +6218,7 @@
public IEnumerator GetEnumerator ()
{
- if (!owner.IsHandleCreated)
+ if (!owner.is_selection_available)
return (new ListViewItem [0]).GetEnumerator ();
ListViewItem [] items = new ListViewItem [Count];
@@ -6260,7 +6264,7 @@
public int IndexOf (ListViewItem item)
{
- if (!owner.IsHandleCreated)
+ if (!owner.is_selection_available)
return -1;
for (int i = 0; i < Count; i++)
@@ -6273,7 +6277,7 @@
#if NET_2_0
public virtual int IndexOfKey (string key)
{
- if (!owner.IsHandleCreated || key == null || key.Length == 0)
+ if (!owner.is_selection_available || key == null || key.Length == 0)
return -1;
for (int i = 0; i < Count; i++) {
_______________________________________________
Mono-patches maillist - Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic