LCL, fix dbgrid entering dataset edit state when selecting a different field and dgAlwaysShowEditor is on

git-svn-id: trunk@28562 -
This commit is contained in:
jesus 2010-11-30 05:58:57 +00:00
parent ab77d54fec
commit 935f55fab1
2 changed files with 18 additions and 6 deletions

View File

@ -390,6 +390,7 @@ type
procedure EditorDoGetValue; override; procedure EditorDoGetValue; override;
function EditorCanAcceptKey(const ch: TUTF8Char): boolean; override; function EditorCanAcceptKey(const ch: TUTF8Char): boolean; override;
function EditorIsReadOnly: boolean; override; function EditorIsReadOnly: boolean; override;
procedure EditorTextChanged(const aCol,aRow: Integer; const aText:string); override;
procedure EndLayout; procedure EndLayout;
function FieldIndexFromGridColumn(AGridCol: Integer): Integer; function FieldIndexFromGridColumn(AGridCol: Integer): Integer;
function FirstGridColumn: Integer; override; function FirstGridColumn: Integer; override;
@ -2333,7 +2334,6 @@ end;
procedure TCustomDBGrid.SetEditText(ACol, ARow: Longint; const Value: string); procedure TCustomDBGrid.SetEditText(ACol, ARow: Longint; const Value: string);
begin begin
if not EditorIsReadOnly then
FTempText := Value; FTempText := Value;
end; end;
@ -2868,6 +2868,13 @@ begin
end; end;
end; end;
procedure TCustomDBGrid.EditorTextChanged(const aCol, aRow: Integer;
const aText: string);
begin
if not EditorIsReadonly then
SetEditText(aCol, aRow, aText);
end;
procedure TCustomDBGrid.HeaderSized(IsColumn: Boolean; Index: Integer); procedure TCustomDBGrid.HeaderSized(IsColumn: Boolean; Index: Integer);
var var
i: Integer; i: Integer;

View File

@ -877,6 +877,7 @@ type
procedure EditorSelectAll; procedure EditorSelectAll;
procedure EditorShow(const SelAll: boolean); virtual; procedure EditorShow(const SelAll: boolean); virtual;
procedure EditorShowInCell(const aCol,aRow:Integer); virtual; procedure EditorShowInCell(const aCol,aRow:Integer); virtual;
procedure EditorTextChanged(const aCol,aRow: Integer; const aText:string); virtual;
procedure EditorWidthChanged(aCol,aWidth: Integer); virtual; procedure EditorWidthChanged(aCol,aWidth: Integer); virtual;
function FirstGridColumn: integer; virtual; function FirstGridColumn: integer; virtual;
function FixedGrid: boolean; function FixedGrid: boolean;
@ -6907,6 +6908,11 @@ begin
end; end;
end; end;
procedure TCustomGrid.EditorTextChanged(const aCol,aRow: Integer; const aText:string);
begin
SetEditText(aCol, aRow, aText);
end;
procedure TCustomGrid.EditorWidthChanged(aCol, aWidth: Integer); procedure TCustomGrid.EditorWidthChanged(aCol, aWidth: Integer);
begin begin
EditorPos; EditorPos;
@ -10857,7 +10863,7 @@ end;
procedure TPickListCellEditor.Select; procedure TPickListCellEditor.Select;
begin begin
if FGrid<>nil then begin if FGrid<>nil then begin
FGrid.SetEditText(FCol, FRow, Text); FGrid.EditorTextChanged(FCol, FRow, Text);
FGrid.PickListItemSelected(Self); FGrid.PickListItemSelected(Self);
end; end;
inherited Select; inherited Select;
@ -10865,9 +10871,8 @@ end;
procedure TPickListCellEditor.Change; procedure TPickListCellEditor.Change;
begin begin
if FGrid<>nil then begin if FGrid<>nil then
FGrid.SetEditText(FCol, FRow, Text); FGrid.EditorTextChanged(FCol, FRow, Text);
end;
inherited Change; inherited Change;
end; end;