GUI Problem BUG?

  • Hey ich habe hier folgende GUI:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <GuiStatusBar.au3>
    #include <ListViewConstants.au3>
    #include <ProgressConstants.au3>
    #include <WindowsConstants.au3>
    #include <guilistview.au3>
    #include <EditConstants.au3>
    #include <comboconstants.au3>
    #include <array.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <GuiImageList.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    FileInstall ("sample1.ico", @TempDir & "\sample1.ico", 1)
    FileInstall ("sample2.ico", @TempDir & "\sample2.ico", 1)
    $iExListViewStyle = BitOR($LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT)
    $Form1 = GUICreate("MAIN GUI", 600, 252, -1, -1,BitOR($WS_CAPTION,$WS_SYSMENU, $WS_MINIMIZEBOX), $WS_EX_ACCEPTFILES)
    $MenuItem1 = GUICtrlCreateMenu("MENU")
    $MenuItem5 = GUICtrlCreateMenuItem("Add Sample1", $MenuItem1)
    $MenuItem9 = GUICtrlCreateMenuItem("Add Sample2", $MenuItem1)
    GUICtrlCreateMenuItem ("",$MenuItem1)
    $MenuItem2 = GUICtrlCreateMenu("MENU")
    $MenuItem6 = GUICtrlCreateMenuItem("MENUITEM", $MenuItem2)
    $MenuItem3 = GUICtrlCreateMenu("MENU")
    $changeview = GUICtrlCreateMenuItem("Change View", $MenuItem3)
    $MenuItem4 = GUICtrlCreateMenu("MENU")
    $MenuItem8 = GUICtrlCreateMenuItem("MENUITEM", $MenuItem4)
    $coder = GUICtrlCreateMenuItem("MENUITEM", $MenuItem4)
    $friends = GUICtrlCreateMenuItem("MENUITEM", $MenuItem4)
    $help = GUICtrlCreateMenu("MENU")
    $friends = GUICtrlCreateMenuItem("MENUITEM", $help)
    $StatusBar1 = _GUICtrlStatusBar_Create($Form1)
    $hListview = GUICtrlCreateListView("Column0|Column1|Column2|Column3|Column4", 0, 0, 599, 194, -1)
    _GUICtrlListView_SetExtendedListViewStyle($hListview, $iExListViewStyle)
    _GUICtrlListView_RegisterSortCallBack($hListview)
    GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 115)
    GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 80)
    GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 100)
    GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 150)
    GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 140)
    $Progress1 = GUICtrlCreateProgress(1, 196, 599, 16)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetState ($hListview, $GUI_DROPACCEPTED)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    Dim $chparam = -1
    Dim $Iparam = -1
    Dim $rfamouspaths = -1
    Dim $dsfjdskl= -1
    Dim $rspecpath= -1
    Dim $ispecpath= -1
    Dim $dsfjdsklfdsf= -1
    Dim $rdefault= -1
    Dim $dsfjdsklfdsfdsfsr= -1
    Dim $rspec= -1
    Dim $rmem = -1
    Dim $dsfjsdfsdlfdsfdsfs = -1
    Dim $sdfsdfd = -1
    Dim $sdfssdfsd = -1
    Dim $sdfssdfs = -1
    Dim $applybutton = -1
    Dim $EDITFORM = -1
    Dim $sdfsdfsdsd = -1
    Dim $sdfadsafbvn = -1
    Dim $test = 0
    Global $better = FALSE

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While WinExists($Form1)
    $nMsg = GUIGetMsg(True)
    Switch $nMsg[0]
    Case $GUI_EVENT_CLOSE
    GUISetState (@SW_ENABLE, $Form1)
    GUIDelete ($nMsg[1])
    Case $GUI_EVENT_DROPPED
    $path = @GUI_DragFile
    edititem($path)
    Case $MenuItem5
    $path = FileOpenDialog ("Select File", @ScriptDir, "All (*.*)")
    if @error then ContinueLoop
    edititem($path)
    Case $MenuItem9
    edititem2("")
    Case $chparam
    if GUICtrlRead ($chparam) = 1 Then
    GUICtrlSetState ($Iparam, $GUI_ENABLE)
    Else
    GUICtrlSetState ($Iparam, $GUI_DISABLE)
    EndIf
    Case $rmem
    GUICtrlSetState ($rfamouspaths, $GUI_DISABLE)
    GUICtrlSetState ($dsfjdskl, $GUI_DISABLE)
    GUICtrlSetState ($rspecpath, $GUI_DISABLE)
    GUICtrlSetState ($ispecpath, $GUI_DISABLE)
    GUICtrlSetState ($dsfjdsklfdsf, $GUI_ENABLE)
    GUICtrlSetState ($rdefault, $GUI_ENABLE)
    GUICtrlSetState ($dsfjdsklfdsfdsfsr, $GUI_ENABLE)
    GUICtrlSetState ($rspec, $GUI_ENABLE)
    if GUICtrlRead ($rspec) = 1 then GUICtrlSetState ($dsfjsdfsdlfdsfdsfs, $GUI_ENABLE)
    GUICtrlSetData ($sdfsdfsdsd, "CHANGEDLABEL")
    Case $rspec
    if GUICtrlRead ($rspec) = 1 then
    GUICtrlSetState ($dsfjsdfsdlfdsfdsfs, $GUI_ENABLE)
    Else
    GUICtrlSetState ($dsfjsdfsdlfdsfdsfs, $GUI_DISABLE)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $dsfjdsklfdsfdsfsr
    GUICtrlSetState ($dsfjsdfsdlfdsfdsfs, $GUI_DISABLE)
    GUICtrlSetData ($sdfsdfsdsd, "CHANGEDLABEL")
    Case $rdefault
    GUICtrlSetState ($dsfjsdfsdlfdsfdsfs, $GUI_DISABLE)
    GUICtrlSetData ($sdfsdfsdsd, "CHANGEDLABEL")
    Case $dsfjdsklfdsf
    GUICtrlSetState ($dsfjsdfsdlfdsfdsfs, $GUI_DISABLE)
    GUICtrlSetData ($sdfsdfsdsd, "CHANGEDLABEL")
    Case $sdfsdfd
    GUICtrlSetState ($rfamouspaths, $GUI_ENABLE)
    GUICtrlSetState ($rspecpath, $GUI_ENABLE)
    GUICtrlSetState ($dsfjdskl, $GUI_ENABLE)
    GUICtrlSetState ($ispecpath, $GUI_ENABLE)
    GUICtrlSetState ($dsfjdsklfdsf, $GUI_DISABLE)
    GUICtrlSetState ($rdefault, $GUI_DISABLE)
    GUICtrlSetState ($dsfjdsklfdsfdsfsr, $GUI_DISABLE)
    GUICtrlSetState ($rspec, $GUI_DISABLE)
    GUICtrlSetState ($dsfjsdfsdlfdsfdsfs, $GUI_DISABLE)
    GUICtrlSetState ($rfamouspaths, $GUI_CHECKED)
    GUICtrlSetData ($sdfsdfsdsd, "CHANGEDLABEL")
    Case $sdfssdfsd
    GUICtrlSetState ($rfamouspaths, $GUI_ENABLE)
    GUICtrlSetState ($rspecpath, $GUI_ENABLE)
    GUICtrlSetState ($dsfjdskl, $GUI_ENABLE)
    GUICtrlSetState ($ispecpath, $GUI_ENABLE)
    GUICtrlSetState ($dsfjdsklfdsf, $GUI_DISABLE)
    GUICtrlSetState ($rdefault, $GUI_DISABLE)
    GUICtrlSetState ($dsfjdsklfdsfdsfsr, $GUI_DISABLE)
    GUICtrlSetState ($rspec, $GUI_DISABLE)
    GUICtrlSetState ($dsfjsdfsdlfdsfdsfs, $GUI_DISABLE)
    GUICtrlSetState ($rfamouspaths, $GUI_CHECKED)
    GUICtrlSetData ($sdfsdfsdsd, "CHANGEDLABEL")
    Case $sdfssdfs
    GUICtrlSetState ($rfamouspaths, $GUI_ENABLE)
    GUICtrlSetState ($rspecpath, $GUI_ENABLE)
    GUICtrlSetState ($dsfjdskl, $GUI_ENABLE)
    GUICtrlSetState ($ispecpath, $GUI_ENABLE)
    GUICtrlSetState ($dsfjdsklfdsf, $GUI_DISABLE)
    GUICtrlSetState ($rdefault, $GUI_DISABLE)
    GUICtrlSetState ($dsfjdsklfdsfdsfsr, $GUI_DISABLE)
    GUICtrlSetState ($rspec, $GUI_DISABLE)
    GUICtrlSetState ($dsfjsdfsdlfdsfdsfs, $GUI_DISABLE)
    GUICtrlSetState ($rfamouspaths, $GUI_CHECKED)
    GUICtrlSetData ($sdfsdfsdsd, "CHANGEDLABEL")
    Case $applybutton
    $indexhandle = GUICtrlCreateListViewItem (Filename($path), $hListView)
    GUICtrlSetImage ($indexhandle, @TempDir & "\sample1.ico")

    [/autoit] [autoit][/autoit] [autoit]

    $tmpindex = _GUICtrlListView_GetItemCount($hListview) - 1
    _GUICtrlListView_SetItem ($hListview, FileGetSize($path), $tmpindex, 1)
    if GUICtrlRead ($rmem) = 1 Then
    if GUICtrlRead ($dsfjdsklfdsf) = 1 then $mode = "blabla"
    if GUICtrlRead ($rdefault) = 1 then $mode = "blabla"
    if GUICtrlRead ($dsfjdsklfdsfdsfsr) = 1 then $mode = "blabla"
    if GUICtrlRead ($rspec) = 1 then $mode = GUICtrlRead ($dsfjsdfsdlfdsfdsfs)
    _GUICtrlListView_SetItem ($hListview, "blabla/"&$mode, $tmpindex, 2)
    EndIf
    if GUICtrlRead ($sdfssdfsd) = 1 Then
    _GUICtrlListView_SetItem ($hListView, "blabla", $tmpindex, 2)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($sdfsdfd) = 1 Then
    _GUICtrlListView_SetItem ($hListView, "blabla", $tmpindex, 2)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($sdfssdfs) = 1 Then
    _GUICtrlListView_SetItem ($hListView, "blabla", $tmpindex, 2)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($rfamouspaths) = 1 Then
    _GUICtrlListView_SetItem ($hListView, GUICtrlRead ($dsfjdskl), $tmpindex, 3)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($rspecpath) = 1 Then
    _GUICtrlListView_SetItem ($hListView, GUICtrlRead ($ispecpath), $tmpindex, 3)
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $mode = ""
    $mode1 = ""
    $mode2 = ""
    if GUICtrlRead ($sdfsdfsdsd) = 1 Then $mode = "blabla"
    if GUICtrlRead ($sdfadsafbvn) = 1 Then $mode1 = "blabla"
    if GUICtrlRead ($chparam) = 1 Then $mode2 = "Parameter: "&GUICtrlRead ($Iparam)
    $moderesult = $mode& "/" & $mode1 &"/" &$mode2
    if StringLeft($moderesult,1) = '/' Then $moderesult = StringTrimLeft($moderesult,1)
    if StringLeft($moderesult,1) = '/' Then $moderesult = StringTrimLeft($moderesult,1)
    if StringRight($moderesult,1) = '/' Then $moderesult = StringTrimRight($moderesult,1)
    if StringRight($moderesult,1) = '/' Then $moderesult = StringTrimRight($moderesult,1)
    if StringInStr ($moderesult, "dfhsdjk") = 0 then
    $moderesult1 = StringLeft($moderesult,17)
    $moderesult2 = StringRight($moderesult,11+StringLen(GUICtrlRead($Iparam)))
    $moderesult = $moderesult1&$moderesult2
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($rmem) = 1 Then
    _GUICtrlListView_SetItem ($hListView, "-", $tmpindex, 3)
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    if $mode = "" and $mode1 = "" and $mode2 = "" then $moderesult = "blabla"
    _GUICtrlListView_SetItem ($hListView, $moderesult, $tmpindex, 4)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState (@SW_ENABLE, $Form1)
    GUIDelete ($EDITFORM)

    [/autoit] [autoit][/autoit] [autoit]

    Case $changeview
    if $better = FALSE Then
    _GUICtrlListView_SetView ($hListview, 1)
    $better = True
    else
    _GUICtrlListView_SetView ($hListview, 0)
    $better = FALSE
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Case $hListview
    _GUICtrlListView_SortItems ($hListview, GUICtrlGetState($hListView))

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Filename ($path)
    if $path = "" Then Return "Error"
    $array = StringSplit ($path, "\", 1)
    Return $array[$array[0]]
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func Filename2 ($path)
    if $path = "" Then Return "Error"
    $array = StringSplit ($path, "/", 1)
    Return $array[$array[0]]
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func edititem ($path)
    $EDITFORM = GUICreate("GUI 1 for "&Filename($path), 447, 372, -1, -1)
    GUICtrlCreateGroup("GROUP", 8, 176, 185, 121)
    $dsfjdsklfdsf = GUICtrlCreateRadio("RADIO", 16, 199, 153, 17)
    GUICtrlSetState (-1, $GUI_CHECKED)
    $rdefault = GUICtrlCreateRadio("RADIO", 16, 215, 113, 17)
    $dsfjdsklfdsfdsfsr = GUICtrlCreateRadio("RADIO", 16, 231, 113, 17)
    $rspec = GUICtrlCreateRadio("RADIO", 16, 247, 113, 17)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    $dsfjsdfsdlfdsfdsfs = GUICtrlCreateInput("", 16, 268, 169, 21)
    GUICtrlSetState (-1, $GUI_DISABLE)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateGroup("GROUP", 8, 48, 185, 121)
    $rmem = GUICtrlCreateRadio("RADIO", 24, 80, 113, 17)
    GUICtrlSetState (-1, $GUI_CHECKED)
    $sdfssdfsd = GUICtrlCreateRadio("RADIO", 24, 96, 145, 17)
    $sdfsdfd = GUICtrlCreateRadio("RADIO", 24, 112, 145, 17)
    $sdfssdfs = GUICtrlCreateRadio("RADIO", 24, 128, 137, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateInput($path, 8, 16, 425, 21, $ES_READONLY)
    GUICtrlCreateGroup("GROUP", 208, 48, 225, 121)
    $dsfjdskl = GUICtrlCreateCombo("COMBO", 224, 91, 185, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetState (-1, $GUI_DISABLE)
    $rfamouspaths = GUICtrlCreateRadio("RADIO", 224, 72, 113, 17)
    GUICtrlSetState (-1, $GUI_DISABLE)
    $rspecpath = GUICtrlCreateRadio("RADIO", 224, 120, 113, 17)
    GUICtrlSetState (-1, $GUI_DISABLE)
    $ispecpath = GUICtrlCreateInput("INPUT", 224, 139, 185, 21)
    GUICtrlSetState (-1, $GUI_DISABLE)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateGroup("Options", 208, 176, 225, 121)
    $sdfsdfsdsd = GUICtrlCreateCheckbox("CHECKBOX", 224, 199, 193, 17)
    $sdfadsafbvn = GUICtrlCreateCheckbox("CHECKBOX", 224, 223, 193, 17)
    $chparam = GUICtrlCreateCheckbox("CHECKBOX", 224, 247, 193, 17)
    $Iparam = GUICtrlCreateInput("", 224, 267, 193, 21)
    GUICtrlSetState (-1, $GUI_DISABLE)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $applybutton = GUICtrlCreateButton("ADD SAMPLE1", 136, 309, 163, 33, $WS_GROUP)
    $seditform = _GUICtrlStatusBar_Create($EDITFORM)
    GUISetState(@SW_SHOW, $EDITFORM)
    GUISetState (@SW_DISABLE, $Form1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func edititem2 ($string2 = "")
    if $string2 = "" Then $string2 = "GUI2"
    $dsfsdsdfs = GUICreate($string2, 452, 382, -1, -1)
    $fdsfjksdl = GUICtrlCreateInput("JUST AN INPUT", 8, 32, 433, 21)
    GUICtrlCreateLabel("LABEL", 8, 8, 77, 17)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    GUICtrlCreateGroup("Group", 8, 64, 185, 129)
    $sdfdsasda = GUICtrlCreateRadio("RADIO", 32, 97, 145, 17, $WS_GROUP)
    GUICtrlSetState (-1, $GUI_CHECKED)
    $kfushf = GUICtrlCreateRadio("RADIO", 32, 113, 153, 17)
    $sdaopiepfsd = GUICtrlCreateRadio("RADIO", 32, 129, 153, 17)
    $sdfiopeiwop = GUICtrlCreateRadio("RADIO", 32, 145, 145, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateGroup("GROUP", 200, 64, 241, 129)
    $sdfeiuiow = GUICtrlCreateRadio("RADIO", 216, 88, 113, 17)
    GUICtrlSetState (-1, $GUI_DISABLE)
    $sdfejioww = GUICtrlCreateCombo("COMBO", 216, 107, 201, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetState (-1, $GUI_DISABLE)
    $sdfewopi = GUICtrlCreateRadio("RADIO", 216, 136, 113, 17)
    GUICtrlSetState (-1, $GUI_DISABLE)
    $dsfewiouerwo = GUICtrlCreateInput("INPUT", 216, 155, 201, 21)
    GUICtrlSetState (-1, $GUI_DISABLE)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Sdlstatusbar = _GUICtrlStatusBar_Create($dsfsdsdfs)
    GUICtrlCreateGroup("GROUP", 8, 200, 185, 121)
    $erewuoiejkldfs = GUICtrlCreateRadio("RADIO", 24, 223, 161, 17)
    GUICtrlSetState (-1, $GUI_CHECKED)
    $efwuiourioew = GUICtrlCreateRadio("RADIO", 24, 239, 113, 17)
    $sdfssdfs = GUICtrlCreateButton("ADD SAMPLE2", 139, 331, 163, 25)
    $rtuoieruio = GUICtrlCreateRadio("RADIO", 24, 255, 113, 17)
    $dfhsdjkhfjksdl = GUICtrlCreateRadio("RADIO", 24, 271, 113, 17)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    $sdfeworie = GUICtrlCreateInput("INPUT", 24, 290, 153, 21)
    GUICtrlSetState (-1, $GUI_DISABLE)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateGroup("GROUP", 200, 200, 241, 121)
    $sdfsdfasddasbcvcv = GUICtrlCreateCheckbox("CHECKBOX.", 208, 224, 225, 17)
    $Chdlparam = GUICtrlCreateCheckbox("CHECKBOX", 208, 272, 145, 17)
    $Idlparam = GUICtrlCreateInput("", 208, 291, 225, 21)
    GUICtrlSetState (-1, $GUI_DISABLE)
    $sdfsdfueioww = GUICtrlCreateCheckbox("CHECKBOX", 208, 248, 225, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW, $dsfsdsdfs)
    GUISetState (@SW_DISABLE, $Form1)
    EndFunc

    [/autoit]

    Die Variablen sind zufällig generiert worden und spielen somit eigentlich nur wenig Rolle.
    Es geht darum, dass ich glaube einen BUG gefunden zu haben, mir aber nicht sicher bin.
    Man macht folgendes:
    Man startet die GUI und klickt auf das erste MENU. Danach klickt man auf ADD SAMPLE2.
    Danach öffnet sich eine GUI. Klickt man nun auf jedes Control (also alle RADIOS/INPUTS etc.), passiert nichts.
    Dann schließt man GUI2 und macht das ganze mit SAMPLE1. (irgendeine Datei auswählen)
    Wenn man auf die Radios etc. von GUI klickt, dann ändern sich einige Controls (so solls auch sein).
    Wenn man auf add Sample klickt, dann wird die Datei in die Listview geladen.
    Die Datei ist nun in der Listview.
    Jetzt macht man nochmal SAMPLE2 und klickt auf ein paar Controls und AutoIT spielt verrückt
    (z.B. werden Controls deaktiviert etc. obwohl in GUI2 nichts inplementiert wurde (also ein EVENT))

    Wie ist das möglich? Oo
    Vielleicht findet ja jemand einen Fehler, aber ich finde keinen.
    Vielen Dank im Voraus.

    Gruß Snify

    Einmal editiert, zuletzt von snify (4. Januar 2010 um 16:11)

  • ja da hast du eindeutig einen bug reingescriptet. :D

    das ganze problem ist das:

    du nutzt mehrere guis aber unterscheidest bei deinem switch case nicht auf welcher gui ein control geklickt/verändert/.... wurde.

    du brauchst GUIGetMsg(1) und ein weiteres swicht case für die verschiedenen guis

    ein einfaches beispiel für 2 Gui's:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    $gui1 = GUICreate('GUI 1', 500, 300, -1, -1)
    $button1 = GUICtrlCreateButton('Aufruf GUI 2', 20, 20, 100, 21)

    [/autoit] [autoit][/autoit] [autoit]

    $gui2 = GUICreate('GUI 2', 500, 300, -1, -1)
    $button2 = GUICtrlCreateButton('Zurück zu GUI 1', 20, 20, 100, 21)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $gui1)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg(1)
    Switch $msg[1] ; window-handle
    Case $gui1
    Switch $msg[0] ; event/control-handle
    Case $button1
    GUISetState(@SW_HIDE, $gui1)
    GUISetState(@SW_SHOW, $gui2)
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    Case $gui2
    Switch $msg[0]
    Case $button2
    GUISetState(@SW_SHOW, $gui1)
    GUISetState(@SW_HIDE, $gui2)
    Case $GUI_EVENT_CLOSE
    GUISetState(@SW_SHOW, $gui1)
    GUISetState(@SW_HIDE, $gui2)
    EndSwitch
    EndSwitch
    WEnd

    [/autoit]