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 begin
//make sure we are in modify mode if can edit //make sure we are in modify mode if can edit
//so if a user changed the selection it can be //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 if not FDataLink.Edit then
begin begin
// restore value // restore value
@ -162,7 +162,10 @@ end;
procedure TCustomDBListBox.EditingDone; procedure TCustomDBListBox.EditingDone;
begin 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; inherited EditingDone;
end; end;
@ -179,8 +182,7 @@ end;
destructor TCustomDBListBox.Destroy; destructor TCustomDBListBox.Destroy;
begin begin
FDataLink.Free; FDataLink.Destroy;
FDataLink := nil;
inherited Destroy; inherited Destroy;
end; end;