|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Virtual desktop makes .NET modal dialog panels disappear(http://www.astonshell.com/), and it is causing a weird and extremely annoying problem with the VB.NET application I am developing. If I start my app, open a test form using ShowDialog() (this is a menu choice on the main app), and then switch to a different virtual desktop, the test form immediately closes (in what seems to be an abnormal way -- the Closing event is raised, but the Closed event is not). This behavior means that while a modal form is open I can't switch to another desktop and do something different. I think this rather defeats the purpose of having virtual desktops! This behavior occurs only when a form is is opened modally -- there are no problems when the same form is opened using Show(). I have not seen this behavior with any other applications. What I need to know of course is whether anyone else has seen this behavior, whether it is a bug or a feature (in either .NET or AltDesk), and most important, whether there is a fix or workaround. I would be most grateful for any ideas or suggestions! Here are some observations (note code at bottom of post): The problem only occurs if the form is waiting for input. If there is code inside my test form that is grinding away doing some work then I can switch to another desktop, and if I switch back before the work is complete the form does not close. However if I don't switch back the form closes when the work is finished and the form is ready for more input. Note the commented code in XYZ_Closing. If I set the DialogResult then the Closed event *does* in fact get raised when a change of desktop triggers a close. If no work is done in XYZ_Closing then the Closed event is not raised (i.e., XYZ_Close is never called). Canceling the close in XYZ_Closing, as one would expect, makes the form (and by extension the application) impossible to close. That is, until I switch to another desktop -- when I do that the form instantly closes, just as if there had been no cancel. And here's something really strange. Suppose I call ShowDialog twice in a row (see below). And suppose that after the form pops up for the first time I then switch to another desktop. What happens is that the first instance of the form closes, then when ShowDialog() is called again the form pops up again -- this time on the new desktop. But strangely, although invoked using ShowDialog(), the second form is not modal! Perhaps relatedly, the second instance of the form does not close if I switch to other desktops. The end result is that I can go back to the application, invoke my test code again, and end up with multiple functional copies of what ought to be a modal form. This just seems bizarre! Anyway, here is some skeletal code: Dim xxx as New XYZ xxx.ShowDialog() 'Pops up in normal way on initial desktop. xxx.ShowDialog() 'Pops up on new desktop, and is not modal. .... 'This is my test form. Public Class XYZ Inherits System.Windows.Forms.Form 'The usual stuff, followed by some test code... Private Sub XYZ_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing Debug.WriteLine("Closing") 'Me.DialogResult = DialogResult.Yes 'Debug.WriteLine("DialogResult set to Yes") 'e.Cancel = True 'Debug.WriteLine("Canceled!") End Sub Private Sub XYZ_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed Debug.WriteLine("Closed") End Sub End Class -- John Brock jbr***@panix.com John Brock wrote (in six (!) newsgroups):
Show quote > If I start my app, open a test form using ShowDialog() (this is a I haven't seen that behavior, but I use MSVDM [Virtual Desktop> menu choice on the main app), and then switch to a different virtual > desktop, the test form immediately closes (in what seems to be an > abnormal way -- the Closing event is raised, but the Closed event > is not). This behavior means that while a modal form is open I > can't switch to another desktop and do something different. I think > this rather defeats the purpose of having virtual desktops! This > behavior occurs only when a form is is opened modally -- there are > no problems when the same form is opened using Show(). I have not > seen this behavior with any other applications. > > What I need to know of course is whether anyone else has seen this > behavior, whether it is a bug or a feature (in either .NET or > AltDesk), and most important, whether there is a fix or workaround. > I would be most grateful for any ideas or suggestions! Manager], not AltDesk. With MSVDM, I lose popup tooltips in my WinForms apps after switching to a different desktop and then switching back. This happened with WinForms 1.1 and still happens in 2.0. A customer's apps that used VS-like dockable, autohide toolwindows (from Janus) would get horribly confused after switching desktops. I haven't found any workaround or fix for these issues, but take (some) comfort from the way that Excel doesn't handle virtual desktops well, either - a maximized Excel window loses its toolbars and menus after a desktop switch, and there doesn't seem to be any way to get them back. The fault *seems* to lie with the virtual desktop managers - it looks like Windows wasn't really designed to support virtual desktops, and the managers have to play various tricks to get it to mostly work. Perhaps vdm-s will be solider under Vista. -- ..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net Delphi skills make .NET easy to learn In print, in stores. On 28/08/2006 in message <ecvc9u$cc***@reader2.panix.com> John Brock wrote:
>At work we are using a virtual desktop manager called AltDesk If you are running it on XP have you tried it with the MS Desktop manager >(http://www.astonshell.com/), and it is causing a weird and extremely >annoying problem with the VB.NET application I am developing. which is a power toy I think? Just in case it's AltDesk causing the issue. -- Jeff Gaines |
|||||||||||||||||||||||