delphidelphi-10.1-berlindelphi-10.2-tokyo

Is there any way to avoid hidden forms being displayed on taskbar mini-window hover?


This pertains to a Delphi application with a child form that has been shown and then hidden but not freed. If a user hovers over the (Windows 10) taskbar "mini-view" of the application the hidden form(s) will become visible (during the hover.) They will hide when the user clicks on the mini-view to change focus to the application. Is there any way to avoid this?

To recreate:

  1. Create a New VCL Forms application.
  2. Add a new form to the project and set it to autocreate.
  3. Add a button to show and then hide the form (or open it with ShowModal)
  4. Run the application
  5. Click the button to show the second form and then close it.
  6. Hover over the applications taskbar button to show the mini-view of the main window.
  7. Hover the mouse over the mini-view and see that the hidden windows appear over the main form.

Note that minimizing the application and restoring it does "fix" the affect until the next time the forms are shown. Perhaps that's a clue as to what is causing it or a clue to a work-around? This isn't a huge issue as it doesn't appear to cause any actual problems, but it does look unprofessional.

Adding code as requested (however it's not going to be very interesting.)

program Project1;
uses
  Vcl.Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {Form2};
{$R *.res}
begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.Run;
end.

// Only code that was added to TForm1:
procedure TForm1.Button1Click(Sender: TObject);
begin
  // Show and then hide the form or use ShowModal and close it before testing the hover.
  Form2.Show;
  Form2.Hide;
  // Form2.ShowModal;
end;

Update: How to show the issue using just the Delphi IDE.

  1. Run Delphi
  2. Open any code file and search for a string and then use F3 until you get the dialog "Search Match Not Found", "Restart search from beginning of the file"
  3. Close the "search match not found" window from step 2.
  4. Hover your mouse over the Delphi taskbar button and then move it to the mini-preview.
  5. You should see the "Search Match Not Found" window appear over the Delphi main window. I've verified this on Berlin and Tokyo (10.2.1)

[2023 Update] This behavior is directly related to the option called "Animate windows when minimizing and maximizing" in System properties, Advanced, Performance settings, on Windows 10 and 11. When that option is turned off the above behavior does not happen.


Solution

  • It appears that Dave Olson's comment about this being Windows version specific is correct. This issue seems to have completely gone away in the latest builds of Windows 10 (even when used with older compiled versions of programs that would show the issue previously.) As an aside I wonder if the people who couldn't reproduce the issue were on the Windows Insider Program and had newer builds.