LCL, dbgrids checks for keydown while dataset is inactive, issue #23598

git-svn-id: trunk@40323 -
This commit is contained in:
jesus 2013-02-15 15:08:35 +00:00
parent 37915accc5
commit a8b95e3a2f

View File

@ -2120,7 +2120,7 @@ begin
VK_TAB: VK_TAB:
begin begin
doOnKeyDown; doOnKeyDown;
if Key<>0 then begin if (Key<>0) and ValidDataset then begin
if dgTabs in Options then begin if dgTabs in Options then begin
if ((ssShift in shift) and if ((ssShift in shift) and
@ -2147,7 +2147,7 @@ begin
VK_RETURN: VK_RETURN:
begin begin
doOnKeyDown; doOnKeyDown;
if Key<>0 then begin if (Key<>0) and ValidDataset then 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
@ -2176,27 +2176,27 @@ begin
end; end;
VK_DOWN: VK_DOWN:
if ValidDataSet then begin begin
DoOnKeyDown; DoOnKeyDown;
if Key<>0 then begin if (Key<>0) and ValidDataset then begin
doVKDown; doVKDown;
Key := 0; Key := 0;
end; end;
end; end;
VK_UP: VK_UP:
if ValidDataSet then begin begin
doOnKeyDown; doOnKeyDown;
if Key<>0 then begin if (Key<>0) and ValidDataset then begin
doVKUp; doVKUp;
key := 0; key := 0;
end; end;
end; end;
VK_NEXT: VK_NEXT:
if ValidDataSet then begin begin
doOnKeyDown; doOnKeyDown;
if Key<>0 then begin if (Key<>0) and ValidDataset then begin
doOperation(opMoveBy, VisibleRowCount); doOperation(opMoveBy, VisibleRowCount);
ClearSelection(true); ClearSelection(true);
Key := 0; Key := 0;
@ -2204,9 +2204,9 @@ begin
end; end;
VK_PRIOR: VK_PRIOR:
if ValidDataSet then begin begin
doOnKeyDown; doOnKeyDown;
if Key<>0 then begin if (Key<>0) and ValidDataset then begin
doOperation(opMoveBy, -VisibleRowCount); doOperation(opMoveBy, -VisibleRowCount);
ClearSelection(true); ClearSelection(true);
key := 0; key := 0;
@ -2216,7 +2216,7 @@ begin
VK_ESCAPE: VK_ESCAPE:
begin begin
doOnKeyDown; doOnKeyDown;
if Key<>0 then begin if (Key<>0) and ValidDataset then begin
if EditorMode then begin if EditorMode then begin
EditorCancelEditing; EditorCancelEditing;
if FDatalink.Active and not FDatalink.Dataset.Modified then if FDatalink.Active and not FDatalink.Dataset.Modified then
@ -2278,7 +2278,7 @@ begin
VK_SPACE: VK_SPACE:
begin begin
doOnKeyDown; doOnKeyDown;
if Key<>0 then begin if (Key<>0) and ValidDataset then begin
if ColumnEditorStyle(Col, SelectedField) = cbsCheckboxColumn then begin if ColumnEditorStyle(Col, SelectedField) = cbsCheckboxColumn then begin
SwapCheckBox; SwapCheckBox;
Key:=0; Key:=0;
@ -2288,7 +2288,8 @@ begin
VK_MULTIPLY: VK_MULTIPLY:
begin begin
if ssCtrl in Shift then doOnKeyDown;
if (Key<>0) and ValidDataset and (ssCtrl in Shift) then
ToggleSelectedRow; ToggleSelectedRow;
end; end;