Gui wie Inet seite

  • Hey Zusammen,

    ich möchte ne Gui erstellen bei denen man auf Zurück klickt und dann wieder auf die erste gelangt und die zweite sich schließt.

    Habs im onevent mode versucht, aber es klappt nicht.

    Kann wer von euch mal drüber schauen...

    Hab ein Beispiel gepostet.

    Spoiler anzeigen

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>


    Opt("GUIOnEventMode", 1)
    $Form1 = GUICreate("Form1", 283, 45, 434, 393)
    $Label1 = GUICtrlCreateLabel("zu Seite 2", 80, 0, 100, 33)
    GUICtrlSetOnEvent($Label1, "Seite2")

    GUICtrlSetFont(-1, 20, 400, 0, "Tele-GroteskFet")
    GUISetState(@SW_SHOW)


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

    EndSwitch
    WEnd

    func Seite2()
    Opt("GUIOnEventMode", 1)
    $Form1 = GUICreate("Form2", 283, 45, 434, 393)
    $Button1 = GUICtrlCreateButton("zurück", 200, 0, 75, 25, $WS_GROUP)
    GUICtrlSetOnEvent($Button1,"zuruck")
    $Label1 = GUICtrlCreateLabel("Seite 2", 80, 0, 100, 33)
    GUICtrlSetFont(-1, 20, 400, 0, "Tele-GroteskFet")
    GUISetState(@SW_SHOW)


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

    EndSwitch
    WEnd
    EndFunc

    func zuruck()
    GUIDelete("Form2")
    EndFunc

  • Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

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

    Local $Form2

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

    Opt("GUIOnEventMode", 1)
    $Form1 = GUICreate("Form1", 283, 45, 434, 393)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    $Label1 = GUICtrlCreateLabel("zu Seite 2", 80, 0, 100, 33)
    GUICtrlSetOnEvent($Label1, "Seite2")

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

    GUICtrlSetFont(-1, 20, 400, 0, "Tele-GroteskFet")
    GUISetState(@SW_SHOW)

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

    While 1
    Sleep(100)
    WEnd

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

    Func Seite2()
    $Form2 = GUICreate("Form2", 283, 45, 434, 393)
    $Button1 = GUICtrlCreateButton("zurück", 200, 0, 75, 25, $WS_GROUP)
    GUICtrlSetOnEvent($Button1, "zuruck")
    $Label1 = GUICtrlCreateLabel("Seite 2", 80, 0, 100, 33)
    GUICtrlSetFont(-1, 20, 400, 0, "Tele-GroteskFet")
    GUISetState(@SW_SHOW)
    EndFunc ;==>Seite2

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

    Func zuruck()
    GUIDelete($Form2)
    EndFunc ;==>zuruck

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

    Func _Exit()
    Exit
    EndFunc ;==>_Exit

    [/autoit]


    So müsste es funktionieren

  • Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

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

    Global $Form1, $Label1, $Form2

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

    Form1()

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

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

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

    Case $Label1
    Seite2()
    ExitLoop
    Exit

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

    EndSwitch
    WEnd

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

    func Seite2()

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

    $Form2 = GUICreate("Form2", 283, 45, 434, 393)
    $Button2 = GUICtrlCreateButton("zurück", 200, 0, 75, 25, $WS_GROUP)
    $Label2 = GUICtrlCreateLabel("Seite 2", 80, 0, 100, 33)
    GUICtrlSetFont(-1, 20, 400, 0, "Tele-GroteskFet")
    GUISetState(@SW_SHOW)

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

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

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

    EndSwitch
    WEnd
    EndFunc

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

    func zuruck()
    GUIDelete($Form2)

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

    EndFunc

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

    Func Form1()
    $Form1 = GUICreate("Form1", 283, 45, 434, 393)
    $Label1 = GUICtrlCreateLabel("zu Seite 2", 80, 0, 100, 33)
    GUICtrlSetOnEvent($Label1, "Seite2")

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

    GUICtrlSetFont(-1, 20, 400, 0, "Tele-GroteskFet")
    GUISetState(@SW_SHOW)
    EndFunc

    [/autoit]

    Bitte.
    Du hast die Winhandles falsch benutzt, und ich habs ohne On Event gemacht.

    mfg Ubuntu

    Edit: Zu spät :rolleyes: (Hab ja auch lange genug gebraucht.)

  • Ich wollte eine Antwort auf diese Frage liefern und ein funktionierendes beispiel schreiben, jedoch fiel mir beim Versuch das skript zu starten auf, das die 2. If Abfrage greift...
    Wobei mir dies unverständlich ist...

    Vielleicht hat jemand ein Kommentar dazu übrig...

    [autoit]


    #include <GUIConstantsEx.au3>
    #include <Array.au3>
    Global $MainGUI,$SubGUI, $back, $next

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

    main()

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

    While 1
    $nMsg = GUIGetMsg(1)

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

    If $nMsg[1] = $MainGUI Then
    Switch $nMsg[0]
    Case $GUI_EVENT_CLOSE
    Exit
    Case $next
    nextform()
    EndSwitch
    ;------------------------------------------------------------Form #1
    ElseIf $nMsg[1] = $SubGUI Then
    Switch $nMsg[0]
    Case $GUI_EVENT_CLOSE
    GUIDelete($SubGUI)
    $SubGUI = -1
    GUISetState(@SW_HIDE,$SubGUI)
    Case $back
    GUIDelete($SubGUI)
    $SubGUI = -1
    GUISetState(@SW_HIDE,$SubGUI)
    EndSwitch
    EndIf
    ;------------------------------------------------------------Form #2
    WEnd

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

    func main()
    $MainGUI = GUICreate("GUI 1", 246, 74, -1, 259)
    $next = GUICtrlCreateButton("Nächste GUI", 18, 18, 75, 25)
    GUISetState(@SW_SHOW)
    EndFunc

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

    Func nextform()
    If Not WinExists("GUI 2") Then
    $SubGUI= GUICreate("GUI 2", 246, 74, -1, 119)
    $back = GUICtrlCreateButton("zurück...", 18, 18, 75, 25)
    GUISetState(@SW_SHOW)
    Else
    GUISetState(@SW_HIDE,$SubGUI)
    GUISetState(@SW_SHOW,$SubGUI)
    EndIf
    EndFunc

    [/autoit]
    Spoiler anzeigen
    Zitat

    Ich weiß wo dein Haus wohnt... 8o