Zur vorherigen GUI wechseln?

  • Hallo Community.

    Gibt es einen Befehl, der von der neu geöffneten GUI zur alten durch einen Button wechseln kann?
    Weil Case $Button1 und dann den GUI Code einfügen, ist mir zu lang...

    Hier mein Script:

    Spoiler anzeigen
    [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #include < GUIConstants.au3 >
    #include < EditConstants.au3 >
    #Region ### START Koda GUI section ### Form=C:\Users\Alex\Desktop\GUI Login.kxf

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

    $Form2 = GUICreate("Login", 338, 72, 330, 172)
    $Input1 = GUICtrlCreateInput("", 32, 8, 161, 21)
    $Input2 = GUICtrlCreateInput("123456789", 32, 32, 161, 21, $ES_PASSWORD)
    $Label1 = GUICtrlCreateLabel("ID", 8, 8, 21, 19)
    GUICtrlSetFont(-1, 11, 400, 0, "@Meiryo")
    $Label2 = GUICtrlCreateLabel("PW", 8, 32, 25, 24)
    GUICtrlSetFont(-1, 10, 400, 0, "@Meiryo")
    $Button1 = GUICtrlCreateButton("LOGIN", 200, 8, 129, 49, 0)
    GUICtrlSetFont(-1, 20, 400, 0, "ArtBrush")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1

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

    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

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

    Case $button1
    If GUIctrlread ($Input1) = "Alex" and GUICtrlRead ($input2) = "korax" Then
    GUIDelete ()
    #include < GUIConstants.au3 >
    #Region ### START Koda GUI section ### Form=

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

    $Form1 = GUICreate("Form1", 625, 445, 193, 125)
    $Button1 = GUICtrlCreateButton("ZURÜCK", 88, 48, 489, 353, 0)
    GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1

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

    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $button1
    EndSwitch

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

    WEnd
    Else

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

    MsgBox (0,"Es ist ein Fehler aufgetreten.","Die Daten waren inkorrekt." & @CRLF & "Bitte versuche es erneut!")
    EndIf
    EndSwitch

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

    WEnd

    [/autoit]

    4 Mal editiert, zuletzt von cOraXx (19. November 2010 um 17:59)

  • Klar geht das. Solltest aber wissen, das man ein kompiliertes Autoitscript ohne Probleme wieder in den Klartext bekommt und damit an die Nutzerdaten:

    Spoiler anzeigen
    [autoit]

    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #Region ### START Koda GUI section ### Form=C:\Users\Alex\Desktop\GUI Login.kxf

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

    $Form2 = GUICreate("Login", 338, 72, 330, 172)
    $Input1 = GUICtrlCreateInput("", 32, 8, 161, 21)
    $Input2 = GUICtrlCreateInput("123456789", 32, 32, 161, 21, $ES_PASSWORD)
    $Label1 = GUICtrlCreateLabel("ID", 8, 8, 21, 19)
    GUICtrlSetFont(-1, 11, 400, 0, "@Meiryo")
    $Label2 = GUICtrlCreateLabel("PW", 8, 32, 25, 24)
    GUICtrlSetFont(-1, 10, 400, 0, "@Meiryo")
    $loginbutton = GUICtrlCreateButton("LOGIN", 200, 8, 129, 49, 0)
    GUICtrlSetFont(-1, 20, 400, 0, "ArtBrush")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 625, 445, 193, 125)
    $zurueck = GUICtrlCreateButton("ZURÜCK", 88, 48, 489, 353, 0)
    GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
    GUISetState(@SW_HIDE)
    #EndRegion ### END Koda GUI section ###

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

    While 1

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

    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $loginbutton
    If GUICtrlRead($Input1) = "Alex" And GUICtrlRead($Input2) = "korax" Then
    GUISetState(@SW_HIDE, $Form2)
    GUISetState(@SW_SHOW, $Form1)
    Else
    MsgBox(0, "Es ist ein Fehler aufgetreten.", "Die Daten waren inkorrekt." & @CRLF & "Bitte versuche es erneut!")
    EndIf
    Case $zurueck
    GUISetState(@SW_HIDE, $Form1)
    GUISetState(@SW_SHOW, $Form2)
    EndSwitch
    WEnd

    [/autoit]

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • Also einfach GUIDelete bei der ersten GUI weglassen, und nach dem drücken des Buttons mit GUISetState verstecken.
    Anschließen bei der 2 GUI beim drücken auf den "Zurück" GUI 1 wieder mit GUISetState einblenden?