lcl: call UpdateRecord in TDBListBox only when loosing focus so selection can be canceled (Delphi compatible)

git-svn-id: trunk@30338 -
This commit is contained in:
blikblum 2011-04-17 11:15:51 +00:00
parent da0e5e00ab
commit 28c3707917

View File

@ -149,7 +149,7 @@ procedure TCustomDBListBox.Click;
begin
//make sure we are in modify mode if can edit
//so if a user changed the selection it can be
//updated, and if not canel out ala ReadOnly
//updated, and if not cancel out ala ReadOnly
if not FDataLink.Edit then
begin
// restore value
@ -162,7 +162,10 @@ end;
procedure TCustomDBListBox.EditingDone;
begin
FDataLink.UpdateRecord;
//update record only when loosing focus to keep the ability to cancel
//after changing the selection more than one time
if not Focused then
FDataLink.UpdateRecord;
inherited EditingDone;
end;
@ -179,8 +182,7 @@ end;
destructor TCustomDBListBox.Destroy;
begin
FDataLink.Free;
FDataLink := nil;
FDataLink.Destroy;
inherited Destroy;
end;