From 3b86b0e6289c8af4f5b0d9fce3d7d953f84d5481 Mon Sep 17 00:00:00 2001 From: juha Date: Fri, 29 Sep 2017 11:57:30 +0000 Subject: [PATCH] LCL: Improve Tab and Enter behavior in TDBGrid when dgRowSelect in options. Issue #32468, patch from Michal Gawrycki. git-svn-id: trunk@55942 - --- lcl/dbgrids.pas | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lcl/dbgrids.pas b/lcl/dbgrids.pas index 55728fea62..ea0b2fe22c 100644 --- a/lcl/dbgrids.pas +++ b/lcl/dbgrids.pas @@ -2381,7 +2381,12 @@ var end; GridFlags := GridFlags + [gfEditingDone]; if (DeltaCol<>0) then - Col := Col + DeltaCol; + if Col + DeltaCol < FixedCols then + Col := FixedCols + else if Col + DeltaCol >= ColCount then + Col := ColCount - 1 + else + Col := Col + DeltaCol; GridFlags := GridFlags - [gfEditingDone]; end else if AReset then @@ -2396,7 +2401,7 @@ begin begin doOnKeyDown; if (Key<>0) and ValidDataset then begin - if (dgTabs in Options) and not (dgRowSelect in Options) then begin + if (dgTabs in Options) then begin if ((ssShift in shift) and (Col<=GetFirstVisibleColumn) and (Row<=GetFirstVisibleRow)) then begin @@ -2428,7 +2433,7 @@ begin key:=0; if (dgEditing in Options) and not EditorMode then EditorMode:=true - else if not (dgRowSelect in Options) then begin + else begin GetDeltaMoveNext(ssShift in Shift, DeltaCol, DeltaRow, AutoAdvance); MoveSel(True); end;