mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 16:00:16 +02:00
fixes dbedit update record only when editing (fixes issue #1561), avoid reseting editmask (part of issue #1532)
git-svn-id: trunk@8421 -
This commit is contained in:
parent
cac3bd154d
commit
5c97042339
@ -117,6 +117,7 @@ Type
|
|||||||
TDBEdit = class(TCustomMaskEdit)
|
TDBEdit = class(TCustomMaskEdit)
|
||||||
private
|
private
|
||||||
FDataLink: TFieldDataLink;
|
FDataLink: TFieldDataLink;
|
||||||
|
FUpdatingRecord: boolean;
|
||||||
|
|
||||||
procedure DataChange(Sender: TObject);
|
procedure DataChange(Sender: TObject);
|
||||||
procedure EditingChange(Sender: TObject);
|
procedure EditingChange(Sender: TObject);
|
||||||
@ -149,6 +150,7 @@ Type
|
|||||||
procedure SetFocus; override;
|
procedure SetFocus; override;
|
||||||
|
|
||||||
procedure EditingDone; override;
|
procedure EditingDone; override;
|
||||||
|
procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -1085,9 +1087,6 @@ begin
|
|||||||
if not Active then
|
if not Active then
|
||||||
FField := nil;
|
FField := nil;
|
||||||
|
|
||||||
if not Active then
|
|
||||||
FField := nil;
|
|
||||||
|
|
||||||
if Assigned(FOnActiveChange) then
|
if Assigned(FOnActiveChange) then
|
||||||
FOnActiveChange(Self);
|
FOnActiveChange(Self);
|
||||||
end;
|
end;
|
||||||
|
@ -40,7 +40,8 @@ begin
|
|||||||
EditText := FDataLink.Field.DisplayText;
|
EditText := FDataLink.Field.DisplayText;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
EditMask := '';
|
//todo: uncomment this when TField implements EditMask
|
||||||
|
//EditMask := ''
|
||||||
Text := '';
|
Text := '';
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -221,8 +222,19 @@ end;
|
|||||||
procedure TDBEdit.EditingDone;
|
procedure TDBEdit.EditingDone;
|
||||||
begin
|
begin
|
||||||
inherited EditingDone;
|
inherited EditingDone;
|
||||||
if FDataLink.CanModify then
|
if FDataLink.CanModify and FDatalink.Editing then begin
|
||||||
|
FUpdatingRecord := True;
|
||||||
FDataLink.UpdateRecord;
|
FDataLink.UpdateRecord;
|
||||||
|
FUpdatingRecord := False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDBEdit.WMKillFocus(var Message: TLMKillFocus);
|
||||||
|
begin
|
||||||
|
if not FUpdatingRecord then
|
||||||
|
inherited WMKillFocus(Message)
|
||||||
|
else
|
||||||
|
FUpdatingRecord := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Public Methods }
|
{ Public Methods }
|
||||||
|
Loading…
Reference in New Issue
Block a user