From 87215599b039c2981205d710d2be76f4e01de928 Mon Sep 17 00:00:00 2001 From: Jing Date: Sun, 30 Jul 2017 09:33:18 +0900 Subject: [PATCH 1/4] fix problem that `SelectionMovedBackward` event should be fired when focus cell moved backward --- ReoGrid/Core/Worksheet/Selection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReoGrid/Core/Worksheet/Selection.cs b/ReoGrid/Core/Worksheet/Selection.cs index d996f272..67ed5495 100644 --- a/ReoGrid/Core/Worksheet/Selection.cs +++ b/ReoGrid/Core/Worksheet/Selection.cs @@ -1125,8 +1125,8 @@ public void MoveSelectionBackward() { if (SelectionMovedBackward != null) { - var arg = new SelectionMoveForwardEventArgs(); - SelectionMovedForward(this, arg); + var arg = new SelectionMovedBackwardEventArgs(); + SelectionMovedBackward(this, arg); if (arg.IsCancelled) { return; From 256d96a26147464d09e3bafd160087d1d8bd6281 Mon Sep 17 00:00:00 2001 From: Jing Date: Sun, 30 Jul 2017 09:35:36 +0900 Subject: [PATCH 2/4] rename `SelectionMoveForwardEventArgs` to `SelectionMovedForwardEventArgs` --- ReoGrid/Core/Worksheet/Selection.cs | 4 ++-- ReoGrid/EventArgs.cs | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ReoGrid/Core/Worksheet/Selection.cs b/ReoGrid/Core/Worksheet/Selection.cs index 67ed5495..b221a777 100644 --- a/ReoGrid/Core/Worksheet/Selection.cs +++ b/ReoGrid/Core/Worksheet/Selection.cs @@ -1062,7 +1062,7 @@ public void MoveSelectionForward() { if (SelectionMovedForward != null) { - var arg = new SelectionMoveForwardEventArgs(); + var arg = new SelectionMovedForwardEventArgs(); SelectionMovedForward(this, arg); if (arg.IsCancelled) { @@ -1477,7 +1477,7 @@ public void MoveSelectionPageUp(bool appendSelect = false) /// /// Event raised when focus-selection move to next position /// - public event EventHandler SelectionMovedForward; + public event EventHandler SelectionMovedForward; /// /// Event raised when focus-selection move to previous position diff --git a/ReoGrid/EventArgs.cs b/ReoGrid/EventArgs.cs index 977a7b85..4b996330 100644 --- a/ReoGrid/EventArgs.cs +++ b/ReoGrid/EventArgs.cs @@ -871,7 +871,7 @@ public ExceptionHappenEventArgs(Worksheet sheet, Exception exception) /// ReoGrid automatically move the selection to 'Right' or 'Down' according /// to 'SelectionForwardDirection' property of control. /// - public class SelectionMoveForwardEventArgs : EventArgs + public class SelectionMovedForwardEventArgs : EventArgs { /// /// Decide whether to cancel current operation @@ -879,10 +879,9 @@ public class SelectionMoveForwardEventArgs : EventArgs public bool IsCancelled { get; set; } /// - /// Create instance for SelectionMoveForwardEventArgs with specified - /// position. + /// Create instance of SelectionMovedForwardEventArgs with specified position. /// - public SelectionMoveForwardEventArgs() + public SelectionMovedForwardEventArgs() { } } From cb87977d5bee7feccae67550143b2c4e6738ef3b Mon Sep 17 00:00:00 2001 From: Jing Date: Sun, 30 Jul 2017 09:36:18 +0900 Subject: [PATCH 3/4] add `SelectionMovedBackwardEventArgs` event argument, use it when `SelectionMovedBackward` event fired --- ReoGrid/Core/Worksheet/Selection.cs | 2 +- ReoGrid/EventArgs.cs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ReoGrid/Core/Worksheet/Selection.cs b/ReoGrid/Core/Worksheet/Selection.cs index b221a777..da0830bf 100644 --- a/ReoGrid/Core/Worksheet/Selection.cs +++ b/ReoGrid/Core/Worksheet/Selection.cs @@ -1482,7 +1482,7 @@ public void MoveSelectionPageUp(bool appendSelect = false) /// /// Event raised when focus-selection move to previous position /// - public event EventHandler SelectionMovedBackward; + public event EventHandler SelectionMovedBackward; #endregion // Events } diff --git a/ReoGrid/EventArgs.cs b/ReoGrid/EventArgs.cs index 4b996330..b8587919 100644 --- a/ReoGrid/EventArgs.cs +++ b/ReoGrid/EventArgs.cs @@ -886,6 +886,26 @@ public SelectionMovedForwardEventArgs() } } + /// + /// Event raised when selection moved to previous position. + /// ReoGrid automatically move selection to left cell or above cell according + /// to SelectionForwardDirection property of worksheet. + /// + public class SelectionMovedBackwardEventArgs : EventArgs + { + /// + /// Decide whether to cancel current move operation. + /// + public bool IsCancelled { get; set; } + + /// + /// Create instance of SelectionMovedBackwardEventArgs with specified position. + /// + public SelectionMovedBackwardEventArgs() + { + } + } + /// /// Argument class for event of BeforeSelectionChange /// From 94994c43cb68413f0528cc43901b07c71eae3f31 Mon Sep 17 00:00:00 2001 From: Jing Date: Sun, 30 Jul 2017 09:37:55 +0900 Subject: [PATCH 4/4] make some code comments more understandable --- ReoGrid/EventArgs.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ReoGrid/EventArgs.cs b/ReoGrid/EventArgs.cs index b8587919..807ebc56 100644 --- a/ReoGrid/EventArgs.cs +++ b/ReoGrid/EventArgs.cs @@ -867,14 +867,14 @@ public ExceptionHappenEventArgs(Worksheet sheet, Exception exception) #region Selection /// - /// Event raised when selection will move to another position. - /// ReoGrid automatically move the selection to 'Right' or 'Down' according - /// to 'SelectionForwardDirection' property of control. + /// Event raised when selection moved to next position. + /// ReoGrid automatically move selection to right cell or below cell according + /// to SelectionForwardDirection property of worksheet. /// public class SelectionMovedForwardEventArgs : EventArgs { /// - /// Decide whether to cancel current operation + /// Decide whether to cancel current move operation. /// public bool IsCancelled { get; set; }