LCL: Improve Tab and Enter behavior in TDBGrid when dgRowSelect in options. Issue #32468, patch from Michal Gawrycki.

git-svn-id: trunk@55942 -
This commit is contained in:
juha 2017-09-29 11:57:30 +00:00
parent 7e8132a70d
commit 3b86b0e628

View File

@ -2381,7 +2381,12 @@ var
end; end;
GridFlags := GridFlags + [gfEditingDone]; GridFlags := GridFlags + [gfEditingDone];
if (DeltaCol<>0) then 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]; GridFlags := GridFlags - [gfEditingDone];
end else end else
if AReset then if AReset then
@ -2396,7 +2401,7 @@ begin
begin begin
doOnKeyDown; doOnKeyDown;
if (Key<>0) and ValidDataset then begin 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 if ((ssShift in shift) and
(Col<=GetFirstVisibleColumn) and (Row<=GetFirstVisibleRow)) then begin (Col<=GetFirstVisibleColumn) and (Row<=GetFirstVisibleRow)) then begin
@ -2428,7 +2433,7 @@ begin
key:=0; key:=0;
if (dgEditing in Options) and not EditorMode then if (dgEditing in Options) and not EditorMode then
EditorMode:=true EditorMode:=true
else if not (dgRowSelect in Options) then begin else begin
GetDeltaMoveNext(ssShift in Shift, DeltaCol, DeltaRow, AutoAdvance); GetDeltaMoveNext(ssShift in Shift, DeltaCol, DeltaRow, AutoAdvance);
MoveSel(True); MoveSel(True);
end; end;