LCL: FilterEdit, search on ASync instead of IDLE. E.g. in the IDE, while compilation runs, filter edits are otherwise not reacting.

This commit is contained in:
Martin 2023-05-29 13:20:27 +02:00
parent 046c226625
commit 3855efa430

View File

@ -236,7 +236,7 @@ type
procedure SetFilterOptions(AValue: TFilterStringOptions); procedure SetFilterOptions(AValue: TFilterStringOptions);
procedure SetSortData(AValue: Boolean); procedure SetSortData(AValue: Boolean);
procedure SetIdleConnected(const AValue: Boolean); procedure SetIdleConnected(const AValue: Boolean);
procedure OnIdle(Sender: TObject; var Done: Boolean); procedure OnAsync(Data: PtrInt);
function IsTextHintStored: Boolean; function IsTextHintStored: Boolean;
protected protected
fNeedUpdate: Boolean; fNeedUpdate: Boolean;
@ -1162,6 +1162,7 @@ end;
destructor TCustomControlFilterEdit.Destroy; destructor TCustomControlFilterEdit.Destroy;
begin begin
IdleConnected := False;
inherited Destroy; inherited Destroy;
end; end;
@ -1241,7 +1242,7 @@ begin
Result := DoDefaultFilterItem(ACaption, ItemData); Result := DoDefaultFilterItem(ACaption, ItemData);
end; end;
procedure TCustomControlFilterEdit.OnIdle(Sender: TObject; var Done: Boolean); procedure TCustomControlFilterEdit.OnAsync(Data: PtrInt);
begin begin
if fNeedUpdate then if fNeedUpdate then
ApplyFilter(true); ApplyFilter(true);
@ -1255,9 +1256,9 @@ begin
if fIdleConnected=AValue then exit; if fIdleConnected=AValue then exit;
fIdleConnected:=AValue; fIdleConnected:=AValue;
if fIdleConnected then if fIdleConnected then
Application.AddOnIdleHandler(@OnIdle) Application.QueueAsyncCall(@OnAsync, 0)
else else
Application.RemoveOnIdleHandler(@OnIdle); Application.RemoveAsyncCalls(Self);
end; end;
procedure TCustomControlFilterEdit.EditKeyDown(var Key: Word; Shift: TShiftState); procedure TCustomControlFilterEdit.EditKeyDown(var Key: Word; Shift: TShiftState);