Author: toshok
Date: 2007-04-04 15:34:33 -0400 (Wed, 04 Apr 2007)
New Revision: 75404
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
Log:
2007-04-04 Chris Toshok <[EMAIL PROTECTED]>
* DataGridTextBoxColumn.cs: set the bounds of the text box to
(0,0,0,0) in Commit, as MS does.
* DataGrid.cs: call EndEdit() from Select() as microsoft does, and
make sure we set CurrentRow on a row header click *before* calling
Select. This moves the current cell (and the textbox) to the new
row. The call to Select then hides the textbox, giving us the
correct behavior. Fixes #80362.
* CurrencyManager.cs (UpdateIsBinding): raise ItemChanged (-1).
(ListChangedHandler): reorder the position/current changed events,
and call UpdateIsBinding in the ItemAdded case.
* GridColumnStylesCollection.cs: add some columns events, one of
which raises the CollectionChanged event.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-04-04 18:54:47 UTC (rev 75403)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-04-04 19:34:33 UTC (rev 75404)
@@ -1,3 +1,21 @@
+2007-04-04 Chris Toshok <[EMAIL PROTECTED]>
+
+ * DataGridTextBoxColumn.cs: set the bounds of the text box to
+ (0,0,0,0) in Commit, as MS does.
+
+ * DataGrid.cs: call EndEdit() from Select() as microsoft does, and
+ make sure we set CurrentRow on a row header click *before* calling
+ Select. This moves the current cell (and the textbox) to the new
+ row. The call to Select then hides the textbox, giving us the
+ correct behavior. Fixes #80362.
+
+ * CurrencyManager.cs (UpdateIsBinding): raise ItemChanged (-1).
+ (ListChangedHandler): reorder the position/current changed events,
+ and call UpdateIsBinding in the ItemAdded case.
+
+ * GridColumnStylesCollection.cs: add some columns events, one of
+ which raises the CollectionChanged event.
+
2007-04-04 Jackson Harper <[EMAIL PROTECTED]>
* TextControl.cs: When we delete multiple selection lines
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
2007-04-04 18:54:47 UTC (rev 75403)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
2007-04-04 19:34:33 UTC (rev 75404)
@@ -292,6 +292,8 @@
foreach (Binding binding in Bindings)
binding.UpdateIsBinding ();
+
+ OnItemChanged (new ItemChangedEventArgs (-1));
}
private void UpdateItem ()
@@ -351,8 +353,10 @@
if (listposition == -1) {
/* do we need this logic up above in
ItemDeleted as well? */
listposition = e.NewIndex == 0 ? 0 :
e.NewIndex - 1;
+ OnPositionChanged (EventArgs.Empty);
OnCurrentChanged (EventArgs.Empty);
- OnPositionChanged (EventArgs.Empty);
+
+ UpdateIsBinding ();
}
OnItemChanged (new ItemChangedEventArgs (-1));
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
2007-04-04 18:54:47 UTC (rev 75403)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
2007-04-04 19:34:33 UTC (rev 75404)
@@ -1465,6 +1465,9 @@
}
}
+ CancelEditing ();
+ CurrentRow = testinfo.Row;
+
if (!ctrl_pressed &&
!shift_pressed &&
!expansion_click) {
@@ -1480,8 +1483,6 @@
Select (testinfo.Row);
}
- CancelEditing ();
- CurrentRow = testinfo.Row;
OnRowHeaderClick (EventArgs.Empty);
break;
@@ -2068,6 +2069,8 @@
public void Select (int row)
{
+ EndEdit();
+
if (selected_rows.Count == 0)
selection_start = row;
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
2007-04-04 18:54:47 UTC (rev 75403)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
2007-04-04 19:34:33 UTC (rev 75404)
@@ -124,6 +124,8 @@
protected internal override bool Commit (CurrencyManager
dataSource, int rowNum)
{
+ textbox.Bounds = Rectangle.Empty;
+
/* Do not write data if not editing. */
if (textbox.IsInEditOrNavigateMode)
return true;
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
2007-04-04 18:54:47 UTC (rev 75403)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
2007-04-04 19:34:33 UTC (rev 75404)
@@ -118,6 +118,7 @@
column.TableStyle = owner;
column.SetDataGridInternal (owner.DataGrid);
+ ConnectColumnEvents (column);
int cnt = items.Add (column);
OnCollectionChanged (new CollectionChangeEventArgs
(CollectionChangeAction.Add, column));
return cnt;
@@ -126,7 +127,7 @@
public void AddRange (DataGridColumnStyle[] columns)
{
foreach (DataGridColumnStyle mi in columns)
- Add (mi);
+ Add (mi);
}
public void Clear ()
@@ -210,13 +211,15 @@
public void Remove (DataGridColumnStyle column)
{
items.Remove (column);
+ DisconnectColumnEvents (column);
OnCollectionChanged (new CollectionChangeEventArgs
(CollectionChangeAction.Remove, column));
}
public void RemoveAt (int index)
{
- object item = items[index];
+ DataGridColumnStyle item =
(DataGridColumnStyle)items[index];
items.RemoveAt (index);
+ DisconnectColumnEvents (item);
OnCollectionChanged (new CollectionChangeEventArgs
(CollectionChangeAction.Remove, item));
}
@@ -237,6 +240,72 @@
#endregion Events
#region Private Instance Methods
+ void ConnectColumnEvents (DataGridColumnStyle col)
+ {
+ col.AlignmentChanged += new EventHandler
(ColumnAlignmentChangedEvent);
+ col.FontChanged += new EventHandler
(ColumnFontChangedEvent);
+ col.HeaderTextChanged += new EventHandler
(ColumnHeaderTextChanged);
+ col.MappingNameChanged += new EventHandler
(ColumnMappingNameChangedEvent);
+ col.NullTextChanged += new EventHandler
(ColumnNullTextChangedEvent);
+ col.PropertyDescriptorChanged += new EventHandler
(ColumnPropertyDescriptorChanged);
+ col.ReadOnlyChanged += new EventHandler
(ColumnReadOnlyChangedEvent);
+ col.WidthChanged += new EventHandler
(ColumnWidthChangedEvent);
+ }
+
+ void DisconnectColumnEvents (DataGridColumnStyle col)
+ {
+ col.AlignmentChanged -= new EventHandler
(ColumnAlignmentChangedEvent);
+ col.FontChanged -= new EventHandler
(ColumnFontChangedEvent);
+ col.HeaderTextChanged -= new EventHandler
(ColumnHeaderTextChanged);
+ col.MappingNameChanged -= new EventHandler
(ColumnMappingNameChangedEvent);
+ col.NullTextChanged -= new EventHandler
(ColumnNullTextChangedEvent);
+ col.PropertyDescriptorChanged -= new EventHandler
(ColumnPropertyDescriptorChanged);
+ col.ReadOnlyChanged -= new EventHandler
(ColumnReadOnlyChangedEvent);
+ col.WidthChanged -= new EventHandler
(ColumnWidthChangedEvent);
+ }
+
+ void ColumnAlignmentChangedEvent (object sender, EventArgs e)
+ {
+ // XXX should this do a CollectionChangedEvent
(Refresh, sender)?
+ }
+
+ void ColumnFontChangedEvent (object sender, EventArgs e)
+ {
+ // XXX should this do a CollectionChangedEvent
(Refresh, sender)?
+ }
+
+ void ColumnHeaderTextChanged (object sender, EventArgs e)
+ {
+ // XXX should this do a CollectionChangedEvent
(Refresh, sender)?
+ }
+
+ void ColumnMappingNameChangedEvent (object sender, EventArgs e)
+ {
+ // XXX should this do a CollectionChangedEvent
(Refresh, sender)?
+ }
+
+ void ColumnNullTextChangedEvent (object sender, EventArgs e)
+ {
+ // XXX should this do a CollectionChangedEvent
(Refresh, sender)?
+ }
+
+ void ColumnPropertyDescriptorChanged (object sender, EventArgs
e)
+ {
+ // XXX should this do a CollectionChangedEvent
(Refresh, sender)?
+ OnCollectionChanged (new CollectionChangeEventArgs
(CollectionChangeAction.Refresh, sender));
+ }
+
+ void ColumnReadOnlyChangedEvent (object sender, EventArgs e)
+ {
+ // XXX should this do a CollectionChangedEvent
(Refresh, sender)?
+ }
+
+ void ColumnWidthChangedEvent (object sender, EventArgs e)
+ {
+ // XXX should this do a CollectionChangedEvent
(Refresh, sender)?
+ }
+
+
private int FromColumnNameToIndex (string columnName)
{
for (int i = 0; i < items.Count; i++) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches