Sometimes when I open a modal window in my Delphi application it takes a while to show up, then I notice that the application is kind of blocked, and what happened was that the modal form was open with ShowModal but wasn't displayed and the application became locked as if the Modal Window was in the first layer.
Usually when this happens I have to use Alt + Tab or Windows + Tab to find the "hidden" modal window, but this doesn't work everytime.
This behavior just happens in Vista, but its quite annoying.
Is there some way to prevent this "focus weirdness" from happening?
Thanks.
* EDIT *
Apparently setting Application.MainFormOnTaskbar := True solved the problem, but it is still too early to jump to conclusions because this happens randomly.
* EDIT 2 *
ModalFormOnTaskbar didn't solve the problem, after that I tried setting PopupMode = pmAuto , but that just made the problem worst.
Right now I'm trying to set the PopupParent explicitly and will let you know if the problem is solved.
To make the active window always on top, press Ctrl + Spacebar (or the keyboard shortcut you assigned). Press the keyboard shortcut again to disable “always on top” for the active window. For script options, right-click on the AutoHotkey icon in the system tray.
This usually happens because of a bug in the code, or because an external system is not working as expected. Software errors can be very frustrating because they often occur at the most inconvenient times, and in unexpected corners of your system.
Click on any part of the active window, or click Window from the menu bar and select the name of the window you want to make active.
Take a look at the PopupParent property. You may want to set it explicitly for your modal form prior to the ShowModal call. When PopupParent is nil (default) VCL behaves a bit differently depending on the value of the related PopupMode property.
If you set the modal form's PopupParent to the form that's active just before you call ShowModal, that may help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With