Let me be the first to admit it. I am still very new GUI arena so these GUI "bugs" may just be a lack of understanding on my part. If this is the case, please accept my apologies in advance.
The problems I found can be best explained (at least for me) with the following 4 examples:
Example 1:
;-- 1st GUI Gui, Add, Edit, r20 w450 Gui, Show, AutoSize, GUI-1 ;-- 2nd GUI Gui, 2:Add, Edit, r1 w200 Gui, 2:Show, AutoSize, GUI-2 Return GuiClose: ExitApp 2GuiClose: Gui, 2:destroy returnIn this example, two independent windows are created. The larger window, GUI-1, is created first, and the smaller window, GUI-2, is created next.
The windows operate as expected.
If the GUI-1 window is clicked on while the GUI-2 is displayed, the GUI-1 window is put into focus and the GUI-2 goes to background.
If either window is minimized, the window will go to the task bar.
If the GUI-2 window is closed, it is destroyed. If the GUI-1 windows is closed, the application is closed, thereby destroying the GUI-1 window and the GUI-2 window (if it exists).
Example 2:
;-- 1st GUI Gui, Add, Edit,r20 w450 Gui, Show, AutoSize, GUI-1 ;-- 2nd GUI Gui, +Disabled Gui, 2:+Owner Gui, 2:Add, Edit, r1 w200 Gui, 2:Show, AutoSize, GUI-2 Return GuiClose: ExitApp 2GuiClose: Gui, -Disabled Gui, 2:Destroy returnIn this example, the same two windows are created. I wanted to disable the GUI-1 window while the GUI-2 is displayed so I added the following statment before the GUI-2 window is created:
Gui, +DisabledI also wanted to force the GUI-2 window to belong the GUI-1 window so I added the following statement before the GUI-2 window is created.
Gui, 2:+OwnerI wanted to re-enable the GUI-1 window before the GUI-2 window is destroyed so I added the following statement in the 2GUiClose subroutine before the statement to destroy the GUI-2 window:
Gui, -DisabledMany window operations don't work as expected. As expected, one independent "window" is created but I'm not sure which one (if any) is the owner.
Problem 1: If you click on the GUI-1 while the GUI-2 is displayed, it appears to work as expected because the GUI-1 window has been successfully disabled. But if you click on any other window and then try to bring the windows back up, you'll quickly see that the two windows are not attached to each other at all. In addition, if you minimize the GUI-2 window, it goes to the bottom left corner of the desktop, not the to task bar.
Problem 2: If you close the GUI-2 window, the GUI-2 is successfully destoyed but the GUI-1 window is not enabled.
Example 3:
;-- 1st GUI Gui, 1:Add, Edit,r20 w450 Gui, 1:Show, AutoSize, GUI-1 ;-- 2nd GUI Gui, 1:+Disabled Gui, 2:+Owner Gui, 2:Add, Edit, r1 w200 Gui, 2:Show, AutoSize, GUI-2 Return GuiClose: ExitApp 2GuiCLose: Gui, 1:-Disabled Gui, 2:Destroy returnTo try to fix the problems I found in the Example 2, I qualified all of the GUI statments by adding a number prefix before the first GUI option. For example:
Gui, 1:Add, Edit,r20 w450The disable/enable problem is fixed, but the ownership problem persists.
Example 4:
;-- 1st GUI Gui, Add, Edit, r20 w450 Gui, Show, AutoSize, GUI-1 ;-- 2nd GUI Gui, 1:+Disabled Gui, 2:+Owner1 Gui, 2:Add, Edit, r1 w200 Gui, 2:Show, AutoSize, GUI-2 Return GuiClose: ExitApp 2GuiCLose: Gui, 1:-Disabled Gui, 2:Destroy returnIn this final example, everything is the same as same as in Example 3 except that I qualified the Owner option as follows:
Gui, 2:+Owner1Everything (IMHO) works like it is supposed to. The only thing that I don't like is that the GUI-2 window blinks 2 or 3 times when you click on the GUI-1 window. But it works, so I'm not (really) complaining.
Conclusions
The following statement appears to work correctly:
Gui, +Disabled..but the following 2 statement don't appear to do anything:
Gui, 2:+Owner
Gui, -DisabledI checked the documentation on the Owner option. Here's the example (and comment) for an unqualified Owner:
gui, 2:+owner ; Make #2 window owned by script's main windowQuestion: Is the "script's main window" supposed to be the 1: window or something else?
I see a lot of "Gui, 2:+Owner" code in a lot of scripts out there but I also see that it doesn't work, at least like I expect it to. Many folks add the "+AlwaysOnTop" option to the 2nd window to give it the illusion of ownership but if you click around, you'll quickly see that the window is not attached to anything other than itself.
There may be problems with other GUI options of this type but these were the ones I was having problems with.
Thank you for your attention.