Windows list dropdown problem
-
Hello, I have several MDI child windows for my application. These show up in the Windows list dropdown menu when I open them. When the user clicks on the X to "close" the child window, I just want to hide it so I capture this in my FormClosing event handler for each of them doing this: if (e.CloseReason == CloseReason.UserClosing) { e.Cancel = true; Hide(); } Which hides the child window just fine, however, when I want to redisplay it, clicking on the appropriate control to call Show() for that window, it displays just fine but I don't get an entry in my Windows list dropdown menu for that item. Any thoughts? Thanks, Matt
-
Hello, I have several MDI child windows for my application. These show up in the Windows list dropdown menu when I open them. When the user clicks on the X to "close" the child window, I just want to hide it so I capture this in my FormClosing event handler for each of them doing this: if (e.CloseReason == CloseReason.UserClosing) { e.Cancel = true; Hide(); } Which hides the child window just fine, however, when I want to redisplay it, clicking on the appropriate control to call Show() for that window, it displays just fine but I don't get an entry in my Windows list dropdown menu for that item. Any thoughts? Thanks, Matt
How do they get into your drop down list to start with ? That's obviously where the problem is.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
How do they get into your drop down list to start with ? That's obviously where the problem is.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
Christian Graus wrote:
How do they get into your drop down list to start with ? That's obviously where the problem is.
Well, I believe I just followed the steps outlined in the MS documentation to do this. I set my main form's IsMdiContainer property to true. I added a menustrip via the designer. The entries are added by setting the MdiWindowListItem property of the menuStrip to the desired menu item (In my test case, "windowToolStripMenuItem") from within the designer and then I call the following when I want form2 to show: form2.MdiParent = this; form2.Show(); The problem seems to me to be when I handle the FormClosing and set e.Cancel = true. I don't know what is going on behind the scenes to manage the list of windows that show up in the menu. I can call Hide() on form2 from its parent window, form1,and when I use the control to show form2 again it shows up in the window list as I would expect. Anyway, thanks for the quick response. Matt