[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-patches
Subject: [Mono-patches] r120304 -
From: "Ivan N. Zlatev (contact () i-nz ! net)" <mono-patches-list () lists ! ximian ! com>
Date: 2008-11-30 19:11:21
Message-ID: 20081130191121.86B659472C () mono-cvs ! ximian ! com
[Download RAW message or body]
Author: ivanz
Date: 2008-11-30 14:10:55 -0500 (Sun, 30 Nov 2008)
New Revision: 120304
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs
Log:
2008-11-30 Ivan N. Zlatev <contact@i-nz.net>
* DataGridView.cs: Move all currentCell setting code into
one central place - SetCurrentCellAddressCore. That way the
current cell is properly updated when programatically set.
Fire RowEnter/Leave events.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 2008-11-30 \
18:33:03 UTC (rev 120303)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 2008-11-30 \
19:10:55 UTC (rev 120304) @@ -1,5 +1,12 @@
2008-11-30 Ivan N. Zlatev <contact@i-nz.net>
+ * DataGridView.cs: Move all currentCell setting code into
+ one central place - SetCurrentCellAddressCore. That way the
+ current cell is properly updated when programatically set.
+ Fire RowEnter/Leave events.
+
+2008-11-30 Ivan N. Zlatev <contact@i-nz.net>
+
* DataGridView.cs: Update the CurrencyManager.Position, so that
when a BindingSource is used BindingSource.Current will be correct.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs 2008-11-30 \
18:33:03 UTC (rev 120303)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs 2008-11-30 \
19:10:55 UTC (rev 120304) @@ -671,9 +671,7 @@
if (value.DataGridView != this) {
throw new ArgumentException("The cell is not in this DataGridView.");
}
- currentCell = value;
- currentRow = currentCell.OwningRow;
- UpdateBindingPosition(currentRow.Index);
+ SetCurrentCellAddressCore (value.ColumnIndex, value.RowIndex, false, true, \
false); }
}
@@ -684,7 +682,11 @@
[Browsable (false)]
public DataGridViewRow CurrentRow {
- get { return currentRow; }
+ get {
+ if (currentCell != null)
+ return currentCell.OwningRow;
+ return null;
+ }
}
[DefaultValue ("")]
@@ -4204,20 +4206,7 @@
return;
}
- if (cell == currentCell) {
- BeginEdit (true);
- return;
- } else if (currentCell != null) {
- EndEdit ();
- OnCellLeave (new DataGridViewCellEventArgs(currentCell.ColumnIndex, \
currentCell.RowIndex));
- }
-
- if (SetCurrentCellAddressCore (cell.ColumnIndex, cell.RowIndex, false, true, \
true)) {
- OnCurrentCellChanged (EventArgs.Empty);
- OnCellEnter (new DataGridViewCellEventArgs(cell.ColumnIndex, cell.RowIndex));
- if (editMode == DataGridViewEditMode.EditOnEnter)
- BeginEdit (true);
- }
+ SetCurrentCellAddressCore (cell.ColumnIndex, cell.RowIndex, false, true, true);
Invalidate();
return;
}
@@ -5313,7 +5302,7 @@
base.SetBoundsCore(x, y, width, height, specified);
}
- [MonoTODO ("Does not use validateCurrentCell or throughMouseClick")]
+ [MonoTODO ("Does not use validateCurrentCell")]
protected virtual bool SetCurrentCellAddressCore (int columnIndex, int rowIndex, \
bool setAnchorCellAddress, bool validateCurrentCell, bool throughMouseClick) {
if ((columnIndex < 0 || columnIndex > Columns.Count - 1) && rowIndex != -1)
@@ -5334,11 +5323,26 @@
if (setAnchorCellAddress)
anchor_cell = new Point (columnIndex, rowIndex);
+ DataGridViewCell oldCell = CurrentCell;
+ currentCell = cell;
currentCellAddress = new Point (columnIndex, rowIndex);
- CurrentCell = cell;
-
- OnCurrentCellChanged (EventArgs.Empty);
-
+ if (currentCell != oldCell) {
+ if (oldCell != null) {
+ EndEdit ();
+ OnCellLeave (new DataGridViewCellEventArgs(oldCell.ColumnIndex, \
oldCell.RowIndex)); + OnRowLeave (new DataGridViewCellEventArgs \
(oldCell.ColumnIndex, oldCell.RowIndex)); + }
+ UpdateBindingPosition (currentCell.RowIndex);
+ OnRowEnter (new DataGridViewCellEventArgs (cell.ColumnIndex, cell.RowIndex));
+ OnCellEnter (new DataGridViewCellEventArgs(cell.ColumnIndex, cell.RowIndex));
+ OnCurrentCellChanged (EventArgs.Empty);
+ if (throughMouseClick && editMode == DataGridViewEditMode.EditOnEnter)
+ BeginEdit (true);
+ } else {
+ if (throughMouseClick)
+ BeginEdit (true);
+ }
+
return true;
}
_______________________________________________
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