"Zurück" Buttom Wie geht der?

  • Ich habe ein eigenes GUI Hauptmenue. Dort Rufe ich ein Untermenue auf. Das hat einen zurück/back buttom. Mit dem will ich zum Hauptmenue gelangen.

    Wie funktioniert so eine Schleife? Was für Funktionen braucht man dafür?

    Quelltext:

    Spoiler anzeigen
    [autoit]


    #include <GUIConstants.au3>

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

    If FileExists("EUOX.exe") Then
    If FileExists("Menues.euo") Then
    If FileExists("Charsammlung.euo") Then
    ;***************************************************
    ;***************** Haupt Menu **********************
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Hauptmenue", 401, 101, 199, 391)
    GUISetCursor (2)
    GUISetFont(8, 800, 4, "Arnprior")
    GUISetBkColor(0x3D95FF)
    $Label1 = GUICtrlCreateLabel("Willkommen Hauptmenu des EierlegendenVollMichsau^^!", 8, 8, 381, 20)
    GUICtrlSetFont(-1, 10, 800, 4, "Arial")
    $Spielen = GUICtrlCreateButton("Spielen", 15, 50, 100, 30, 0)
    GUICtrlSetFont(-1, 8, 800, 4, "Arial")
    GUICtrlSetCursor (-1, 0)
    GUISetState(@SW_SHOW)
    $Char_anlegen = GUICtrlCreateButton("Char_anlegen", 130, 50, 150, 30, 0)
    GUICtrlSetFont(-1, 8, 800, 4, "Arial")
    GUICtrlSetCursor (-1, 0)
    GUISetState(@SW_SHOW)
    $Skript_Patchen = GUICtrlCreateButton("Skript_Patchen", 290, 50, 100, 30, 0)
    GUICtrlSetFont(-1, 8, 800, 4, "Arial")
    GUICtrlSetCursor (-1, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

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

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

    Case $Skript_Patchen
    ;***************************************************
    ;***************** Skript_Patchen ******************
    #Region ### START Koda GUI section ### Form=C:\Dokumente und Einstellungen\busch.GAIAAKKU\Desktop\JagtSkript.exe\FormSkriptSpeicherort.kxf
    $Form2 = GUICreate("Skriptspeicherort", 401, 251, 199, 391)
    GUISetCursor (2)
    GUISetFont(8, 400, 0, "Arial")
    GUISetBkColor(0x3D95FF)
    $Label2 = GUICtrlCreateLabel("Hir kommt der Path zu den neuen Skript Quellcode rein.", 8, 16, 383, 20)
    GUICtrlSetFont(-1, 10, 800, 4, "MS Sans Serif")
    $Label1 = GUICtrlCreateLabel("Path:", 8, 60, 56, 28)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("", 70, 60, 300, 22)
    GUICtrlSetCursor (-1, 5)
    $Button1 = GUICtrlCreateButton("Speichern", 262, 102, 105, 30)
    GUICtrlSetFont(-1, 8, 800, 4, "Arial")
    GUICtrlSetCursor (-1, 0)
    GUISetState(@SW_SHOW)
    $Label3 = GUICtrlCreateLabel("zB. c:\....\...\(Ver.1.0)J.euo", 72, 88, 132, 18)
    $Combo1 = GUICtrlCreateCombo("", 70, 160, 300, 22)
    If FileExists(@ScriptDir & '\SkriptPathangaben.txt') Then
    $file = FileOpen ( "SkriptPathangaben.txt", 0 )
    If $file = -1 Then
    MsgBox(0, "Error", "Kann Datei nicht Öffnen!")
    Exit
    EndIf
    $AllLines = ""
    While 1
    $line = FileReadLine($file)
    If @error = -1 Then
    StringTrimRight($AllLines, 1)
    ExitLoop
    EndIf
    $AllLines &= $line &"|"
    Dim $AllLines2 = $AllLines
    WEnd
    Else
    MsgBox(4096,"Warnung" , "SkriptPathangaben.txt does NOT exists")
    EndIf
    GUICtrlSetData($Combo1, $AllLines2)
    $Label4 = GUICtrlCreateLabel("Alte Versionen einfach Auswählen.", 70, 136, 76, 22)
    GUISetState(@SW_SHOW)
    $Button2 = GUICtrlCreateButton("Speichern", 263, 204, 105, 30)
    GUICtrlSetFont(-1, 8, 800, 4, "Arial")
    GUICtrlSetCursor (-1, 0)
    GUISetState(@SW_SHOW)
    --------------------> $back = GUICtrlCreateButton("Zurück", 71, 206, 105, 30)
    GUICtrlSetFont(-1, 8, 800, 4, "Arial")
    GUICtrlSetCursor (-1, 0)
    GUISetState(@SW_SHOW)
    $Label5 = GUICtrlCreateLabel("Oder:", 8, 112, 52, 28)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    $Path = GuiCtrlRead($Input1)
    If FileExists(@ScriptDir & '\SkriptPathangaben.txt') Then
    $file = FileOpen ( "SkriptPathangaben.txt", 1 )
    If $file = -1 Then
    MsgBox(0, "Error", "Kann Datei nicht Öffnen!")
    Exit
    EndIf
    FileWrite($file, @CRLF)
    FileWrite($file, $Path )
    FileClose($file)
    ;Ab hir ein Code um direckt den Phat beim Button Spielen zu Setzen. + Wo er noch eingesetzt werden soll

    Else
    MsgBox(4096,"Warnung" , "SkriptPathangaben.txt does NOT exists")
    EndIf
    Case $Button2
    $auswahl = GUICtrlRead($Combo1)
    ;Ab hir ein Code um direckt den Phat beim Button Spielen zu Setzen. + Wo er noch eingesetzt werden soll
    ;Case $back
    EndSwitch
    WEnd
    ;******** Skript_Patchen Ende **********************
    ;***************************************************
    ;Case $Char_anlegen
    ;***************************************************
    ;***************** Char_anlegen ********************

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

    (xxxxxxxxxxxxxx)

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Hallo Skar,
    ich mache das immer so:
    Ich habe 2 GUI's !
    Eins wie direkt angezeigt. (GUISetState(@SW_SHOW, $Form1))
    Das andere verstecke ich vorerst. (GUISetState(@SW_HIDE, $Form2))
    Wenn ich dann auf den Weiter Button klicke sieht das so aus:

    [autoit]

    Case $Weiter
    GUISetState (@SW_HIDE, $Form1) ;Die erste GUI verstecken
    GUISetState (@SW_SHOW, $Form2); Die verstecke GUI öffnen

    [/autoit]


    Somit habe ich dann einen weiter Knopf.
    Für Back genau das selbe nur anders herum ^^

    [autoit]

    Case $Back
    GUISetState (@SW_HIDE, $Form2)
    GUISetState (@SW_SHOW, $Form1)

    [/autoit]


    Um es dir zu veranschaulichen habe ich dir noch ein Skript beigepackt wo ich einen Weiter/Zurück knopf benutze !
    Ab 189 geht es los ^^
    Da benutze ich vor und zurück Buttons!
    Vieleicht hilft es dir ja!

    PS: Das Skript war für einen USB Stick von mir ^^ Du wirst es wahrscheinlich nicht ausführen können ^^ Aber ich wollte dir nur den Code zeigen!