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
if not (FGrid.DataSource.DataSet.State in dsEditModes) then
FGrid.DataSource.Edit;
if Self.Text <> '' then
FGrid.SelectedField.AsDateTime := Self.Date
else
FGrid.SelectedField.Clear;
if FGrid <> nil then
begin begin
if TryStrToDate(Text, D) then if TryStrToDate(Text, D) then
FGrid.SetEditText(FCol, FRow, Text) FGrid.EditorTextChanged(FCol, FRow, Text)
else else
FGrid.SetEditText(FCol, FRow, ''); FGrid.EditorTextChanged(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,6 +2852,9 @@ procedure TRxDBGridDateEditor.msg_GetValue(var Msg: TGridMessage);
var var
sText: string; sText: string;
begin begin
if Date = NullDate then
sText := ''
else
sText := Text; sText := Text;
Msg.Value := sText; Msg.Value := sText;
end; end;