Sign in to follow this  
Followers 0
prayags

unable to switch between two GUIs

3 posts in this topic

hi 

pl help me. 

1. main GUI opens. with two button (button 3 and Button 4)

2. as i click on Button4, GUI 2 opens up. as i clock this GUI, it goes back to Main GUI.

again if i click on Button4, nothing happens.\

 

 

#include <GUIConstantsEx.au3>


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("main", 475, 400, -1, -1)
$Group3 = GUICtrlCreateGroup("", 0, 0, 475, 400)
GUISetBkColor(0xFFFFFF)
$Group2 = GUICtrlCreateGroup("GRP 2", 40, 208, 401, 137)
GUICtrlSetFont(-1, 11, 800, 0, "MS Sans Serif")
$Label = GUICtrlCreateLabel("Coming Soon...........", 104, 248, 300, 22)
GUICtrlSetFont(-1, 11, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group1 = GUICtrlCreateGroup("GRP 1", 40, 40, 401, 145)
GUICtrlSetFont(-1, 11, 800, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("BUTTON 3", 72, 80, 129, 33)
GUICtrlSetFont(-1, 11, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xD7E4F2)
$Button4 = GUICtrlCreateButton("$Button4", 248, 80, 129, 33)
GUICtrlSetFont(-1, 11, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xD7E4F2)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button3
            GUISwitch($Form1)
            GUISetState (@SW_Hide, "main")

            #Region ### START Koda GUI section ### Form=c:\users\eprayde\desktop\form2.kxf
            $Form1_1 = GUICreate("GUI 1", 922, 671, -1, -1)
            $Button5 = GUICtrlCreateButton("About", 824, 8, 75, 25)
            GUISetState(@SW_SHOW)
            #EndRegion ### END Koda GUI section ###
            While 1
            $nMsg1 = GUIGetMsg()
            Switch $nMsg1
                Case $GUI_EVENT_CLOSE
                    GUIDelete($Form1_1)
                    GUISetState (@SW_SHOW, "main")
                    Exitloop
                Case $Button5
                    GUIDelete($Form1_1)
                    GUISetState (@SW_SHOW, "main")
                    Exitloop
            EndSwitch
            WEnd
        Case $Button4
            GUISwitch($Form1)
            GUISetState (@SW_Hide, "main")

            #Region ### START Koda GUI section ### Form=c:\users\eprayde\desktop\form2.kxf
            $Form1_2 = GUICreate("GUI 2", 922, 671, -1, -1)
            $Button5 = GUICtrlCreateButton("About", 824, 8, 75, 25)
            GUISetState(@SW_SHOW)
            #EndRegion ### END Koda GUI section ###
            While 1
            $nMsg1 = GUIGetMsg()
            Switch $nMsg1
                Case $GUI_EVENT_CLOSE
                    GUIDelete($Form1_2)
                    GUISetState (@SW_SHOW, "main")
                    Exitloop
                Case $Button5
                    GUIDelete($Form1_2)
                    GUISetState (@SW_SHOW, "main")
                    Exitloop
            EndSwitch
            WEnd
EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites



Look in https://www.autoitscript.com/wiki/Managing_Multiple_GUIs for the solution, it's the last example in "MessageLoop Mode" after the remark:

Quote

So here is an example of how to manage two GUIs simultaneously using the "advanced" parameter with GUIGetMsg:

 

Share this post


Link to post
Share on other sites

Thnks!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0