From 1f50407f92e1bf4920b3adbac52839e47aa2253b Mon Sep 17 00:00:00 2001 From: alexs75 Date: Fri, 23 Aug 2019 07:24:28 +0000 Subject: [PATCH] RxFPC:fix RxDBGrid date editor git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7146 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/trunk/rxdb/rxdbgrid.pas | 29 +++++++++-------------- components/rx/trunk/rxtools/rxlogging.pas | 2 +- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/components/rx/trunk/rxdb/rxdbgrid.pas b/components/rx/trunk/rxdb/rxdbgrid.pas index 504aa3048..92050d061 100644 --- a/components/rx/trunk/rxdb/rxdbgrid.pas +++ b/components/rx/trunk/rxdb/rxdbgrid.pas @@ -1286,7 +1286,7 @@ type FCol, FRow: integer; protected procedure EditChange; override; - procedure KeyDown(var Key: word; Shift: TShiftState); override; + procedure EditKeyDown(var Key: word; Shift: TShiftState); override; procedure WndProc(var TheMessage: TLMessage); override; procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID; @@ -2712,32 +2712,22 @@ end; { TRxDBGridDateEditor } - procedure TRxDBGridDateEditor.EditChange; var D:TDateTime; begin inherited EditChange; - if Assigned(FGrid) and FGrid.DatalinkActive and not FGrid.EditorIsReadOnly then + if (FGrid<>nil) and Visible then begin - if not (FGrid.DataSource.DataSet.State in dsEditModes) then - FGrid.DataSource.Edit; - if Self.Text <> '' then - FGrid.SelectedField.AsDateTime := Self.Date + if TryStrToDate(Text, D) then + FGrid.EditorTextChanged(FCol, FRow, Text) else - FGrid.SelectedField.Clear; - - if FGrid <> nil then - begin - if TryStrToDate(Text, D) then - FGrid.SetEditText(FCol, FRow, Text) - else - FGrid.SetEditText(FCol, FRow, ''); - end; + FGrid.EditorTextChanged(FCol, FRow, '') end; end; -procedure TRxDBGridDateEditor.KeyDown(var Key: word; Shift: TShiftState); + +procedure TRxDBGridDateEditor.EditKeyDown(var Key: word; Shift: TShiftState); function AllSelected: boolean; begin @@ -2862,7 +2852,10 @@ procedure TRxDBGridDateEditor.msg_GetValue(var Msg: TGridMessage); var sText: string; begin - sText := Text; + if Date = NullDate then + sText := '' + else + sText := Text; Msg.Value := sText; end; diff --git a/components/rx/trunk/rxtools/rxlogging.pas b/components/rx/trunk/rxtools/rxlogging.pas index 6f599f62f..82b8e1a4d 100644 --- a/components/rx/trunk/rxtools/rxlogging.pas +++ b/components/rx/trunk/rxtools/rxlogging.pas @@ -61,7 +61,7 @@ end; procedure RxWriteLog(ALogType: TEventType; const ALogMessage: string; Params: array of const); begin - RxWriteLog(ALogType, Format(ALogMessage, Params)); + RxWriteLog(ALogType, Format(ALogMessage, Params)); end; procedure RxDefaultWriteLog(ALogType: TEventType; const ALogMessage: string);