Found a bug where Gui doesn't trigger GuiClose after Gui multitabs

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dbgba
Posts: 20
Joined: 02 Apr 2021, 22:11

Found a bug where Gui doesn't trigger GuiClose after Gui multitabs

25 Jan 2024, 01:52

After pressing the jump button, the default Gui's GuiClose label will be invalidated
The demo code is as follows:

Code: Select all

; Goto JumpNewGui

Gui BugReproduction: Add, Text, Section, After clicking on the jump button. clicking the close button in the top right corner of the new GUI does not trigger the GuiClose label.
Gui BugReproduction: Add, Button, ys-5 gJumpNewGui, Jump to a new page
Gui BugReproduction: Show, , Bug Reproduction - Test Window 1
Return

JumpNewGui:
Gui BugReproduction: Destroy
Gui Add, Text, Section, Now. clicking the close button in the top right corner of this window does not trigger the GuiClose label.
Gui Show, , Bug Reproduction - New Test Window 2
Return

; BugReproductionGuiClose:
GuiClose:
  MsgBox GuiClose label pops up to confirm the label trigger.
  ExitApp
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Found a bug where Gui doesn't trigger GuiClose after Gui multitabs

25 Jan 2024, 06:23

You found the bug in your script. The jump routine uses the GUI name that you provided. If you don't want to use it, remove all of the GUI names. You don't need them since you are using only one GUI at a time. If you want to name them, then specify the names of the GUIs. As far as I know, a thread is going to continue to use any GUI that you name, until changed. Your two scripts already provide the evidence that this is true. I find this concept similar to the concept of "last found window". Details

Code: Select all

#Requires AutoHotkey v1.1.33
Gui 2:New
Gui Add, Text,, After clicking on the jump button blablabla
Gui Add, Button,, Jump to a new page
Gui Show,, Bug Reproduction - Test Window 1
Return

2ButtonJumpToANewPage:
Gui 2:New
Gui Add, Text, Section, Now. clicking the close button in the top blablabla...
Gui Show,, Bug Reproduction - New Test Window 2
Return

2GuiClose:
MsgBox GuiClose label pops up to confirm the label trigger.
ExitApp

Code: Select all

#Requires AutoHotkey v1.1.33
Gui -SysMenu
Gui Add, Text,, After clicking on the jump button blablabla
Gui Add, Button,, Jump to a new page
Gui Show,, Bug Reproduction - Test Window 1
Return

ButtonJumpToANewPage:
Gui Destroy
Gui Add, Text, Section, Now. clicking the close button in the top blablabla...
Gui Show,, Bug Reproduction - New Test Window 2
Return

GuiClose:
MsgBox GuiClose label pops up to confirm the label trigger.
ExitApp

Code: Select all

#Requires AutoHotkey v1.1.33
Gui Add, Text,, After clicking on the jump button blablabla
Gui Add, Button,, Jump to a new page
Gui Show,, Bug Reproduction - Test Window 1
Return

ButtonJumpToANewPage:
Gui 1:New, +Hwndpage2
Gui Add, Text, Section, Now. clicking the close button in the top blablabla...
Gui Show,, Bug Reproduction - New Test Window 2
Return

GuiClose:
If WinActive("A") = page2
 MsgBox GuiClose label pops up to confirm the label trigger.
ExitApp

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], peter_ahk and 353 guests