omnibrain 23 Posted Tuesday at 02:08 PM 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 136 Posted Tuesday at 03:10 PM (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 Tuesday at 03:16 PM by mvanrijnen Share this post Link to post
Anders Melander 2127 Posted Tuesday at 03:39 PM 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 1674 Posted Tuesday at 03:52 PM 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 23 Posted Tuesday at 05:45 PM 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 423 Posted Tuesday at 07:43 PM 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