omnibrain 26 Posted September 30 In our application a various user triggered dialogs that are modal popups. And there is one dialop that gets externally triggered via message. Now the following can happen: A user open one of the modal popups. While he works in the popup the message triggered popup is triggered and opens modally. But it opens behind another window of the application. Now the user is stuck. Is there anything I can do, to either ensure that the automatically opened popup is always the topmost window, or another way to resolve this conflict? For example detect if there is already another modal window/dialog open for the application? Share this post Link to post
mvanrijnen 137 Posted September 30 (edited) wasn't there something like a NormalizeWindows method (vcl, winapi) that handled this? see: Vcl.Forms.TApplication.NormalizeTopMosts - RAD Studio API Documentation (maybe not what you ment, this is about topmost property) Edited September 30 by mvanrijnen Share this post Link to post
Anders Melander 2203 Posted September 30 1 hour ago, omnibrain said: modal popups Assuming you meant modal dialogs or modal forms (a popup is usually something else - and not modal), with regard to the problematic form: Have you modified the value of the PopupMode property on the form? Do you set the Parent property of the form? Share this post Link to post
Remy Lebeau 1694 Posted September 30 Worse case, you can try manually setting the modal dialog's PopupParent to the active form (the VCL should already be doing that, but maybe its buggy?). Share this post Link to post
omnibrain 26 Posted September 30 2 hours ago, Anders Melander said: Assuming you meant modal dialogs or modal forms (a popup is usually something else - and not modal), Yes, form or dialog, via .showmodal. I think I found a solution in my case: The automatic Popup (I'll continue to call it that way) only makes sense if the user is able to not only interact with it, but follow through. In case of him having another modal window on screen he evidently isn't. Those are small dialogs for tasks that need to be immediately handled. So before showing the automatic window I check if Application.ModalLevel=0 and if not, I simply don't create the window and give the message back to the scheduler/broker. Share this post Link to post
aehimself 435 Posted September 30 I solved this with my custom TDimPanel descendant. I have a topmost TDimPanel (which I call ModalPanel) which accepts frame descendants (called ModalContents) to show. If a content is shown everything is pushed back, only the most recent is visible and can be interacted with. Based on this logic you also can implement your own, programmable modal order - with TDimPanel or without. 1 Share this post Link to post
Softacom | Company 10 Posted October 30 There is one more thing you need to know: when an application does not process system messages for 5 seconds, Windows decides that your application has frozen and may cause problems with the pop-up window stack. This often happens if your modal forms use long operations in the OnCreate or OnShow events (for example, some database operations). To prevent this, try moving long operations from these events to other events that fire after the form is displayed, or move all the heavy work to a separate thread. Share this post Link to post
aehimself 435 Posted November 2 Read again OP's question. Application isn't frozen. 1 1 Share this post Link to post