Fractured Posted February 18, 2020 Share Posted February 18, 2020 Good morning all! I was trying out the Managing Multiple GUI tutorial and I cant seem to get GUI2's Msgbox to fire. I renamed the variables so it is easier for me to follow but the code is all the same as the tutorial. Any help would be greatly appreciated since id love to use this feature. Thanks! expandcollapse popup#include <Array.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $hGUI2 = 9999, $b_MBox2 ; Predeclare the variables with dummy values to prevent firing the Case statements, only for GUI this time gui1() Func gui1() Local $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100) Local $b_MBox1 = GUICtrlCreateButton("Msgbox 1", 10, 10, 80, 30) Local $b_SGUI2 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30) GUISetState() Local $aMsg While 1 $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array Switch $aMsg[1] ; check which GUI sent the message Case $hGUI1 Switch $aMsg[0] ; Now check for the messages for $hGUI1 Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we exit <<<<<<<<<<<<<<< ExitLoop Case $b_MBox1 MsgBox($MB_OK, "MsgBox 1", "Test from Gui 1") Case $b_SGUI2 GUICtrlSetState($b_SGUI2, $GUI_DISABLE) gui2() EndSwitch Case $hGUI2 Switch $aMsg[0] ; Now check for the messages for $g_hGUI2 Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<< GUIDelete($hGUI2) GUICtrlSetState($b_SGUI2, $GUI_ENABLE) Case $b_MBox2 MsgBox($MB_OK, "MsgBox", "Test from Gui 2") EndSwitch EndSwitch WEnd EndFunc ;==>gui1 Func gui2() $hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350) Local $b_MBox2 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30) GUISetState() EndFunc ;==>gui2 Link to comment Share on other sites More sharing options...
Fractured Posted February 18, 2020 Author Share Posted February 18, 2020 Ok, I just copied the MessageLoop mode example from another post and it seems to work, while the copy from the Wiki/Tutorial didn't work...huh... So im going to look at both and see what is different! Link to comment Share on other sites More sharing options...
Nine Posted February 18, 2020 Share Posted February 18, 2020 Your $b_MBox2 is declared local ! Fractured 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Fractured Posted February 18, 2020 Author Share Posted February 18, 2020 ok, just on a quick glance, the only difference I found was that the Wiki/Tutorial shows this under Func gui2() --> Local $g_idButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30) while the copy from the other post shows this under Func gui2() --> $g_idButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30) Since in the tutorial it uses Local, does that make it unseen outside the Func gui2()? Link to comment Share on other sites More sharing options...
Fractured Posted February 18, 2020 Author Share Posted February 18, 2020 Hahaha! Nice one @Nine! That's what I thought!! You commented before I could finish the post above!! That is how it was declared in the tutorial...just didn't catch it...wondering whom I let know so that can get fixed in the wiki/tutorial for us bumbling newbies!! Link to comment Share on other sites More sharing options...
Nine Posted February 18, 2020 Share Posted February 18, 2020 You can post it in bug tracker, that also applies to documentation and wiki, if I am not mistaken... Fractured 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Fractured Posted February 18, 2020 Author Share Posted February 18, 2020 Awesome @Nine! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now