Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to have more than one modal dialog?

in one of our web applications we have a base frame we use for showing modal dialogs. The base frame contains a TIWModalWindow component with IWFrameRegion as its ContentElement, as well as common code for logging and language support. In descendant frames we add visual elements, decide which buttons to use (e.g. OK & Cancel), add code to the ModalWindow.OnAsyncClick event handler etc. A using form creates such a frame (at runtime) when it wants to show it and calls a method ShowModal() of the frame (which sets Visible = True and calls ModalWindow.Show()). This has worked nicely.

Now we have a form where we want to be able to show more than one modal dialog (although not at the same time). You should be able to change data in the GUI of dialog 1, close it, open dialog 2, do some changes, close it and reopen dialog 1 with your earlier changes retained, etc. However, the rendering fails as soon as I try to open the second dialog. I have attached a simplified example project that demonstrates this. I have tried various things in the OnAsyncClose event handler such as setting Parent to nil for the frame, setting ModalDialog.ContentElement to nil, calling ModalWindow.Reset() etc. but with no luck.

Is there a way of having more than one modal dialog "in memory" like we want here? Has it something to do with multiple instances of the TIWModalWindow component? Please advice on what we need to change in order to solve this problem.

Best regards

Magnus Oskarsson

Attached Files
.zip (Size: 5.75 KB / Downloads: 2)

Messages In This Thread
How to have more than one modal dialog? - by magosk - 09-16-2019, 11:31 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)