Jump to content
omnibrain

How to handle conflicting modal popups

Recommended Posts

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
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

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
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

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.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×