mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 19:59:37 +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)
|
||||
private
|
||||
FDataLink: TFieldDataLink;
|
||||
FUpdatingRecord: boolean;
|
||||
|
||||
procedure DataChange(Sender: TObject);
|
||||
procedure EditingChange(Sender: TObject);
|
||||
@ -149,6 +150,7 @@ Type
|
||||
procedure SetFocus; override;
|
||||
|
||||
procedure EditingDone; override;
|
||||
procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -1085,9 +1087,6 @@ begin
|
||||
if not Active then
|
||||
FField := nil;
|
||||
|
||||
if not Active then
|
||||
FField := nil;
|
||||
|
||||
if Assigned(FOnActiveChange) then
|
||||
FOnActiveChange(Self);
|
||||
end;
|
||||
|
@ -40,7 +40,8 @@ begin
|
||||
EditText := FDataLink.Field.DisplayText;
|
||||
end
|
||||
else begin
|
||||
EditMask := '';
|
||||
//todo: uncomment this when TField implements EditMask
|
||||
//EditMask := ''
|
||||
Text := '';
|
||||
end;
|
||||
end;
|
||||
@ -221,8 +222,19 @@ end;
|
||||
procedure TDBEdit.EditingDone;
|
||||
begin
|
||||
inherited EditingDone;
|
||||
if FDataLink.CanModify then
|
||||
if FDataLink.CanModify and FDatalink.Editing then begin
|
||||
FUpdatingRecord := True;
|
||||
FDataLink.UpdateRecord;
|
||||
FUpdatingRecord := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDBEdit.WMKillFocus(var Message: TLMKillFocus);
|
||||
begin
|
||||
if not FUpdatingRecord then
|
||||
inherited WMKillFocus(Message)
|
||||
else
|
||||
FUpdatingRecord := False;
|
||||
end;
|
||||
|
||||
{ Public Methods }
|
||||
|
Loading…
Reference in New Issue
Block a user