Hi Frans, On 12/5/07, Frans Bouma <[EMAIL PROTECTED]> wrote: > > I've not seen this behavior before, but here are some pointers which might > help: > 1) always make the application's main form the PARENT of the modal dialog. > Don't ever open a modal dialog with the desktop as parent for example.
So if I have the following scenario Window 1 --opens---> Window 2 ----opens---> Window3 And Window3 is a modal dialog box, then the parent is Window1 and not Window2??? 2) in the properties of a dialog, you can specify to show the dialog in the > taskbar. It might be a good idea to switch this on. The modal dialog will > get > its own button in the taskbar and if the dialog gets hidden or minimized, > the > user can select it again by clicking the button in the taskbar This would seem like an awkward fix. My assumption is that .NET should know to make the modal dialog's Z-Order ahead of any other application window. That would seem really easy to implement but they haven't done it that way (hence a modal dialog could be behind other windows)... again, strange. 3) never ever open 2 modal dialogs at once. The concept of a modal dialog is > to make sure the user fulfills the dialog before continuing with the > application. If you need to open more than one, consider other layouts of > the > UI. This I am doing. Which is what I'm thinking of reversing. But this would also seem rather restrictive. Imagine you had a modal dialog and from that dialog you wanted to show a message box. That's 2 modal dialogs at once. So if you have a custom modal dialog you can't use any of the system provided modal dialog boxes?? 4) modal dialogs don't need to have their topmost flag set to true. I have > found that setting that flag gives odd results. > > FB > > > Strangely, I've been hitting this problem. Having been a java programmer > in > > the past, I was very surprised when the same problems exhibited > themselves > > in .NET. > > > > The problem is namely thus: > > When using modal dialogs (custom or system provided), you can end up > with a > > situation whereby the modal dialog has not been destroyed or closed, and > is > > either invisible or can't be see/rendered - either because the Z-Order > is > > stuffed (ie it always renders behind another dialog that is not modal) > or > > the dialog is just invisible. Sometimes the user can get back control > doing > > alt-tab. More often than not, the application just becomes stuck. > > > > This creates the following situation - the user can't interact with your > app > > any longer. The only way they can close the app is to do a ctrl-alt-del > and > > kill the process. The annoying part about this is that it is > indeterminate - > > sometimes it occurs, other times it just works. But the end result is a > > stuck application with no way to recover. > > > > Firstly, has anybody experienced this sort of thing and how did they go > > about fixing it? I'm tempted to rip up all my modal dialog code and just > go > > modaless - and rely on callbacks and states rather than on deterministic > > 'blocking' and handle user input blocking myself. Seems a bloody awful > waste > > of time - to have to re-implement modality though. > > > > Secondly, the application I have written is more than just a few simple > > dialogs. I have modal dialogs, which open other modal dialogs. I'm > wandering > > if this is this the cause of the problem? I've written a simple test, > and > > the behaviour looks ok - but with all things, once it's in a real app, > > things are different. > > > > I've tried ALL available solutions include providing a suitable/accurate > > parent (the top most form), but somehow either .NET or Window's just > can't > > render things properly. And the problem seems to occur for both system > > provided dialogs (including MessageBox, OpenFileDialog, > > OpenDirectoryDialogs) and my own forms. > > > > -- > > Cheers, > > Jason > > > > =================================== > > This list is hosted by DevelopMentorR http://www.develop.com > > > > View archives and manage your subscription(s) at > http://discuss.develop.com > > =================================== > This list is hosted by DevelopMentor(R) http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > -- Cheers, Jason =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com