Continue to apply filter of table list after refresh but clear it when changing database. Fixes issue #3466.

This commit is contained in:
adri.granger
2014-01-27 09:36:35 +00:00
parent 27121eb42f
commit 4b768afb21

View File

@ -1090,6 +1090,7 @@ type
procedure SetProgressState(State: TProgressbarState); procedure SetProgressState(State: TProgressbarState);
procedure TaskDialogHyperLinkClicked(Sender: TObject); procedure TaskDialogHyperLinkClicked(Sender: TObject);
function HasDonated(ForceCheck: Boolean): TThreeStateBoolean; function HasDonated(ForceCheck: Boolean): TThreeStateBoolean;
procedure ApplyVTFilter(FromTimer: Boolean);
end; end;
@ -6998,18 +6999,26 @@ end;
procedure TMainForm.TimerFilterVTTimer(Sender: TObject); procedure TMainForm.TimerFilterVTTimer(Sender: TObject);
begin
// Disable timer to avoid filtering in a loop
TimerFilterVT.Enabled := False;
// Code moved into this procedure in order to call it by different way
ApplyVTFilter(True);
end;
procedure TMainForm.ApplyVTFilter(FromTimer: Boolean);
var var
Node : PVirtualNode; Node: PVirtualNode;
VT : TVirtualStringTree; VT: TVirtualStringTree;
i : Integer; i: Integer;
match : Boolean; match: Boolean;
search : String; search: String;
tab: TTabSheet; tab: TTabSheet;
VisibleCount: Cardinal; VisibleCount: Cardinal;
CellText: String; CellText: String;
begin begin
// Disable timer to avoid filtering in a loop
TimerFilterVT.Enabled := False;
// Find the correct VirtualTree that shall be filtered // Find the correct VirtualTree that shall be filtered
tab := PageControlMain.ActivePage; tab := PageControlMain.ActivePage;
if tab = tabHost then if tab = tabHost then
@ -7071,7 +7080,11 @@ begin
+ IntToStr(VT.RootNodeCount - VisibleCount) + ' hidden.'; + IntToStr(VT.RootNodeCount - VisibleCount) + ' hidden.';
end else end else
lblFilterVTInfo.Caption := ''; lblFilterVTInfo.Caption := '';
VT.Invalidate;
if FromTimer then
VT.Invalidate
else
InvalidateVT(VT, VTREE_LOADED, true);
end; end;
@ -7756,6 +7769,10 @@ procedure TMainForm.DatabaseChanged(Connection: TDBConnection; Database: String)
begin begin
// Immediately force db icons to repaint, so the user sees the active db state // Immediately force db icons to repaint, so the user sees the active db state
DBtree.Repaint; DBtree.Repaint;
// Clear Filter issue 3466
FFilterTextDatabase := '';
if ActiveQueryHelpers <> nil then if ActiveQueryHelpers <> nil then
ActiveQueryHelpers.Invalidate; ActiveQueryHelpers.Invalidate;
end; end;
@ -7882,6 +7899,8 @@ begin
editDatabaseFilter.OnChange(editDatabaseFilter); editDatabaseFilter.OnChange(editDatabaseFilter);
if editTableFilter.Text <> '' then if editTableFilter.Text <> '' then
editTableFilter.OnChange(editTableFilter); editTableFilter.OnChange(editTableFilter);
if editFilterVT.Text <> '' then
ApplyVTFilter(False);
end; end;
end; end;