473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Virtual desktop makes .NET modal dialog panels disappear

At work we are using a virtual desktop manager called AltDesk
(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
jb****@panix.com

Aug 28 '06 #1
2 1577
John Brock wrote (in six (!) newsgroups):
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!
I haven't seen that behavior, but I use MSVDM [Virtual Desktop
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.
Aug 28 '06 #2
On 28/08/2006 in message <ec**********@reader2.panix.comJohn Brock wrote:
>At work we are using a virtual desktop manager called AltDesk
(http://www.astonshell.com/), and it is causing a weird and extremely
annoying problem with the VB.NET application I am developing.
If you are running it on XP have you tried it with the MS Desktop manager
which is a power toy I think? Just in case it's AltDesk causing the issue.

--
Jeff Gaines
Aug 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: martin de vroom | last post by:
Hi, I have a web page that opens a modal dialog (client side) in the following manner onclick="window.showModalDialog('/dialog.asp',null,'dialogHeight: 200px; dialogWidth: 400px; dialogTop:...
2
by: Gilles T. | last post by:
Hi, How I can refresh a modal dialog in asp.net? I open a modal dialog in first with a dropdownlist. To add a element in my dropdownlist (table), I open a second modal dialog to ask element and...
2
by: cassidyc | last post by:
Hi, I was wondering if anyone has come accross this issue? And if they have any solutions I have that can create new copies of itself Form1 as = new form1(); af.show(); This form can also...
10
by: Guadala Harry | last post by:
I have a modal dialog that currently does all of the following except item 4. 1. lets users select a graphic from a list of thumbnails (and when selected, displays the full-size image in a...
2
by: John Brock | last post by:
At work we are using a virtual desktop manager called AltDesk (http://www.astonshell.com/), and it is causing a weird and extremely annoying problem with the VB.NET application I am developing. ...
2
by: sthrudel | last post by:
Hi! I'm working on a web application in Asp.net and what I would like to have is a cross borwser modal dialog which accepts user's input. I would like to catch what the user clicked on the...
3
by: frosted74 | last post by:
Hi, I have 2 javascript functions, one that sorts a table and one that shows/hides a modal dialog that displays something like "Sorting" with a little icon indicating that the browser is "busy"...
2
by: diogenes | last post by:
I have created many shortcut/popup (aka context, or right-click) menus for my application - instead of toolbars or standard drop-down menus. Within my custom menu, I am using...
3
by: Andrea Gasperi | last post by:
Hi there not sure if this is the right place but i'm proud to use for the first time the "Managed Newsgroups" feature of my brand new MSDN subscription :-) So here is the problem. I've...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.