LCL: fix dbedit losing edit state on ALT+TAB and on just dragging the dbedit parent window, both seen in linux, issue #22475

git-svn-id: trunk@46276 -
This commit is contained in:
jesus 2014-09-21 18:31:28 +00:00
parent f980457103
commit 17e9c7f7e6
2 changed files with 9 additions and 1 deletions

View File

@ -166,6 +166,7 @@ Type
private
FDataLink: TFieldDataLink;
FCustomEditMask: Boolean;
FFocusedDisplay: boolean;
procedure DataChange(Sender: TObject);
procedure UpdateData(Sender: TObject);
function GetDataField: string;

View File

@ -14,6 +14,7 @@
}
// included by dbctrls.pp
{.$define UpdDisplay}
{ Private Methods }
@ -31,7 +32,7 @@ begin
//if we are focused its possible to edit,
//if the field is currently modifiable
if Focused and FDataLink.CanModify then begin
if FFocusedDisplay and FDatalink.CanModify then begin
//display the real text since we can modify it
RestoreMask(DatalinkField.Text);
end else
@ -194,6 +195,9 @@ procedure TDBEdit.WMSetFocus(var Message: TLMSetFocus);
begin
inherited WMSetFocus(Message);
// some widgetsets do not notify clipboard actions properly. Put at edit state at entry
if FFocusedDisplay then
exit;
FFocusedDisplay := true;
if WidgetSet.GetLCLCapability(lcReceivesLMClearCutCopyPasteReliably) = LCL_CAPABILITY_YES then
FDataLink.Reset
else
@ -203,6 +207,9 @@ end;
procedure TDBEdit.WMKillFocus(var Message: TLMKillFocus);
begin
inherited WMKillFocus(Message);
FFocusedDisplay := False;
if FDatalink.Editing then
begin
FDatalink.UpdateRecord;