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;