This problem just keeps confusing me.

I create a dialog called “dlgPleaseWait”, I then add a property of type “dlgPleaseWait” to the session.

I then want to have one instance of the dialog that I can use throughout my app but for life of me I just cant work out how to do this.

Wow, I’d never imagined doing that. One way you might do this one dialog per Session thing is to create a WebPage called wpDialogs. Put instances of your dialogs on that page. They will appear in the footer as invisible controls. To show one:


Its Dismissed event handler will have to figure out the context and do the right thing.

Ok but how would you do it within a single page. So for example you have an open event where you create the dialog but you want it to stay visible and then in say a timer event once you have done things you want to hide the dialog. How would you reference the dialog as the instance of it would have disappeared because the open event has finished and closed. I am sure this is simply my misunderstanding of classes / properties /oops etc but it is confusing the hell out of me :wink:

I haven’t tried, but can’t you simply do this?

// Do your opening code

No need to create a property or add it to the page.

No that doesnt work because the nature of everything happening in an event at the client side all fires at the same time so in effect the dialog shows and is hidden in the same event so is never displayed.

Here’s a very rough proof of concept using one WebPage and one WebDialog. It shows a Please Wait dialog while some long process takes place and then closes the dialog when the process is complete. The same dialog is used repeatedly for different processes. The example has only two processes but you could have many and certainly improve upon the design for your needs. Threads could be used for the long processes, the dialog could have a Cancel button, it could all be packaged nicely into something more portable from one project to another, etc.

Hopefully that helps, even if it’s not exactly what you’re looking for.

That’s actually pretty close to what I might do. The requirement to add a dialog to a page like a control was lifted a long time ago. Sometimes it’s best to do it that way, sometimes it’s better to create instances on the fly. Though…if memory serves…there’s a thread somewhere on this forum about a memory leak bug with dynamically created dialogs.