How to make sure the dialog is always ahead of the main window

I have not yet found a better solution for this. I have a non-modal dialog that can be opened in unlimited instances using the hotkey in the application. Even the dialogue itself can open a new instance. I want these dialogs to always be in front of the main application window. I tried a couple of things.

  • Set FormStyle to fsStayOntop. This works, but has the advantage that the dialog will be in front of all windows, even in other applications. I just want it in front of my main window.
  • Set PopupMode to pmAuto. This also works, unless another dialog box opens in one dialog box. If the first dialog box closes, it automatically closes the second. This is unacceptable.
  • Use the default properties for the form. Once the main window is clicked, open dialogs are located behind the main window.

Any other suggestions :-)

+3
source share
4 answers

From TCustomForm.PopupParent Property ;

If the PopupMode property is set to pmExplicit and PopupParent is zero, then Application.MainForm is implicitly used as PopupParent

.

+7
source

AFAIK Delphi 2007 supports the MainFormOnTaskbar function. WITH

   Application.MainFormOnTaskbar := True;

in the project source, ANY application form (with the default parent window) is shown above the main form.


, , "//" . , Delphi, - .

+2

, , fsstayontop, - . , Windows, - Delphi.

, Z, .

If your dialogue is not so large as to hide other applications, you can move it, and users can access other applications without first entering the dialogue. It doesn't seem so bad.

0
source

You can try to look at the OnHide event and immediately set the Visible flag to TRUE. This is likely to cause flickering.

-1
source

All Articles