From 77d0809361522438c55d5d574aac09acf9547129 Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 5 Dec 2015 11:30:16 +0000 Subject: [PATCH] Grids: Do not move to another cell when user presses Left/Right in editor. Issue #29084 git-svn-id: branches/fixes_1_6@50634 - --- lcl/grids.pas | 24 ++++++++++++++++-------- lcl/valedit.pas | 5 ++++- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lcl/grids.pas b/lcl/grids.pas index 1ea36e7c01..87bc106201 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -6897,15 +6897,23 @@ begin end else TabCheckEditorKey; VK_LEFT: - if Relaxed then - MoveSel(True, -cBidiMove[UseRightToLeftAlignment], 0) - else - MoveSel(True, 0,-1); + //Don't move to another cell is user is editing + if not FEditorKey then + begin + if Relaxed then + MoveSel(True, -cBidiMove[UseRightToLeftAlignment], 0) + else + MoveSel(True, 0,-1); + end; VK_RIGHT: - if Relaxed then - MoveSel(True, cBidiMove[UseRightToLeftAlignment], 0) - else - MoveSel(True, 0, 1); + //Don't move to another cell is user is editing + if not FEditorKey then + begin + if Relaxed then + MoveSel(True, cBidiMove[UseRightToLeftAlignment], 0) + else + MoveSel(True, 0, 1); + end; VK_UP: MoveSel(True, 0, -1); VK_DOWN: diff --git a/lcl/valedit.pas b/lcl/valedit.pas index e0c3197d4c..7428435f67 100644 --- a/lcl/valedit.pas +++ b/lcl/valedit.pas @@ -1190,7 +1190,10 @@ begin end; Result:=inherited GetDefaultEditor(Column); //Need this to be able to intercept VK_Delete in the editor - EditorOptions := EditorOptions or EO_HOOKKEYDOWN; + if (KeyDelete in KeyOptions) then + EditorOptions := EditorOptions or EO_HOOKKEYDOWN + else + EditorOptions := EditorOptions and (not EO_HOOKKEYDOWN); if Column=1 then begin ItemProp := nil;