Jump to content

It possible to do that?


Recommended Posts

I don't know if that is possible to do, for example i've this code

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Try", 180, 40, 192, 124)
$Button1 = GUICtrlCreateButton("New Gui", 8, 8, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("New Gui", 96, 8, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            MsgBox (0,"","Gui2")
            _NewGui()

    EndSwitch
WEnd

Func _NewGui()
$Form2 = GUICreate("Try 2", 180, 40, 192, 124)
$Button3 = GUICtrlCreateButton("Gui 2", 8, 8, 75, 25, $WS_GROUP)
$Button4 = GUICtrlCreateButton("Gui 2", 96, 8, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button3
            MsgBox (0,"","Gui 2")
            _NewGui()

    EndSwitch
WEnd
EndFunc

If i click "New Gui" Button, on Gui number 1 it give me another gui...but gui 1 becomes unusable,indeed only gui 2 work well...is possible to make the two gui working together ?

Hi :x

Link to comment
Share on other sites

It work good, but i've to use to loop like that :

#include <GUIConstantsEx.au3>

Global $hGUI2 = 9999, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements

gui1()

Func gui1()

    $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100)
    $input2 = GUICtrlCreateInput("", 10, 10, 80, 30)
    $hButton2 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30)
    GUISetState()

    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 $hButton2
                        GUICtrlSetState($hButton2, $GUI_DISABLE)
                        gui2()
                EndSwitch
            Case $hGUI2
                Switch $aMsg[0] ; Now check for the messages for $hGUI2
                    Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<<
                        GUIDelete($hGUI2)
                        GUICtrlSetState($hButton2, $GUI_ENABLE)
                    Case $hButton3
                        MsgBox("", "MsgBox", "Test from Gui 2")
                EndSwitch
        EndSwitch

        GUICtrlSetData ($Input2,@HOUR & ':' & @MIN & ':' & @SEC)
    WEnd

EndFunc   ;==>gui1

Func gui2()

    $hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350)
    $Input2 = GUICtrlCreateInput("", 10, 10, 80, 30)
    GUISetState()
    While 1
    Sleep (500)
    GUICtrlSetData ($Input2,@HOUR & ':' & @MIN & ':' & @SEC)
    WEnd
EndFunc   ;==>gui2

For Example how i can do working togheter the two gui?...how u can see i use too loop :)

Hi!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...