RxFPC:fix RxDBGrid date editor

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7146 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2019-08-23 07:24:28 +00:00
parent 5556aa10db
commit 1f50407f92
2 changed files with 12 additions and 19 deletions

View File

@ -1286,7 +1286,7 @@ type
FCol, FRow: integer; FCol, FRow: integer;
protected protected
procedure EditChange; override; 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 WndProc(var TheMessage: TLMessage); override;
procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID; procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID;
@ -2712,32 +2712,22 @@ end;
{ TRxDBGridDateEditor } { TRxDBGridDateEditor }
procedure TRxDBGridDateEditor.EditChange; procedure TRxDBGridDateEditor.EditChange;
var var
D:TDateTime; D:TDateTime;
begin begin
inherited EditChange; inherited EditChange;
if Assigned(FGrid) and FGrid.DatalinkActive and not FGrid.EditorIsReadOnly then if (FGrid<>nil) and Visible then
begin begin
if not (FGrid.DataSource.DataSet.State in dsEditModes) then if TryStrToDate(Text, D) then
FGrid.DataSource.Edit; FGrid.EditorTextChanged(FCol, FRow, Text)
if Self.Text <> '' then
FGrid.SelectedField.AsDateTime := Self.Date
else else
FGrid.SelectedField.Clear; FGrid.EditorTextChanged(FCol, FRow, '')
if FGrid <> nil then
begin
if TryStrToDate(Text, D) then
FGrid.SetEditText(FCol, FRow, Text)
else
FGrid.SetEditText(FCol, FRow, '');
end;
end; end;
end; end;
procedure TRxDBGridDateEditor.KeyDown(var Key: word; Shift: TShiftState);
procedure TRxDBGridDateEditor.EditKeyDown(var Key: word; Shift: TShiftState);
function AllSelected: boolean; function AllSelected: boolean;
begin begin
@ -2862,7 +2852,10 @@ procedure TRxDBGridDateEditor.msg_GetValue(var Msg: TGridMessage);
var var
sText: string; sText: string;
begin begin
sText := Text; if Date = NullDate then
sText := ''
else
sText := Text;
Msg.Value := sText; Msg.Value := sText;
end; end;

View File

@ -61,7 +61,7 @@ end;
procedure RxWriteLog(ALogType: TEventType; const ALogMessage: string; procedure RxWriteLog(ALogType: TEventType; const ALogMessage: string;
Params: array of const); Params: array of const);
begin begin
RxWriteLog(ALogType, Format(ALogMessage, Params)); RxWriteLog(ALogType, Format(ALogMessage, Params));
end; end;
procedure RxDefaultWriteLog(ALogType: TEventType; const ALogMessage: string); procedure RxDefaultWriteLog(ALogType: TEventType; const ALogMessage: string);