diff --git a/lcl/dbgrids.pas b/lcl/dbgrids.pas index 7d1d92b7cc..f7a6a786b2 100644 --- a/lcl/dbgrids.pas +++ b/lcl/dbgrids.pas @@ -390,6 +390,7 @@ type procedure EditorDoGetValue; override; function EditorCanAcceptKey(const ch: TUTF8Char): boolean; override; function EditorIsReadOnly: boolean; override; + procedure EditorTextChanged(const aCol,aRow: Integer; const aText:string); override; procedure EndLayout; function FieldIndexFromGridColumn(AGridCol: Integer): Integer; function FirstGridColumn: Integer; override; @@ -2333,8 +2334,7 @@ end; procedure TCustomDBGrid.SetEditText(ACol, ARow: Longint; const Value: string); begin - if not EditorIsReadOnly then - FTempText := Value; + FTempText := Value; end; procedure TCustomDBGrid.SetFixedCols(const AValue: Integer); @@ -2868,6 +2868,13 @@ begin 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); var i: Integer; diff --git a/lcl/grids.pas b/lcl/grids.pas index 37e4dfa8b7..1e8e1675f3 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -877,6 +877,7 @@ type procedure EditorSelectAll; procedure EditorShow(const SelAll: boolean); virtual; procedure EditorShowInCell(const aCol,aRow:Integer); virtual; + procedure EditorTextChanged(const aCol,aRow: Integer; const aText:string); virtual; procedure EditorWidthChanged(aCol,aWidth: Integer); virtual; function FirstGridColumn: integer; virtual; function FixedGrid: boolean; @@ -6907,6 +6908,11 @@ begin end; end; +procedure TCustomGrid.EditorTextChanged(const aCol,aRow: Integer; const aText:string); +begin + SetEditText(aCol, aRow, aText); +end; + procedure TCustomGrid.EditorWidthChanged(aCol, aWidth: Integer); begin EditorPos; @@ -10857,7 +10863,7 @@ end; procedure TPickListCellEditor.Select; begin if FGrid<>nil then begin - FGrid.SetEditText(FCol, FRow, Text); + FGrid.EditorTextChanged(FCol, FRow, Text); FGrid.PickListItemSelected(Self); end; inherited Select; @@ -10865,9 +10871,8 @@ end; procedure TPickListCellEditor.Change; begin - if FGrid<>nil then begin - FGrid.SetEditText(FCol, FRow, Text); - end; + if FGrid<>nil then + FGrid.EditorTextChanged(FCol, FRow, Text); inherited Change; end;