2 Guis in 1x

  • Hallo Leute!

    Wie kann ich verhindern das die 2 Gui mit dem 1 Gui mitschliesst.

    Gui 1 öffnen --> Gui 2 öffen --> Gui 2 schliessen --> Gui 1 wird mitgeschlossen.. :)

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #NoTrayIcon
    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.2.9.3 (beta)
    Author: TensoX

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

    Script Function:
    Template AutoIt script.

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

    #ce ----------------------------------------------------------------------------
    ; Tray Einstellungen

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

    Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.

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

    $prefsitem = TrayCreateItem("Preferences")
    TrayCreateItem("")
    $aboutitem = TrayCreateItem("About")
    TrayCreateItem("")
    $exititem = TrayCreateItem("Exit")
    ; Tray Ende

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

    ; Start
    #Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\USER\desktop\blaaaaa
    \bla
    $Form1_1 = GUICreate("Tuybook 1.0 beta", 588, 370, 193, 115)
    GUISetFont(8, 400, 0, "Tahoma")
    $Viewer = GUICtrlCreateButton("Viewer", 16, 16, 203, 97, 0)
    GUICtrlSetFont(-1, 8, 800, 4, "Tahoma")
    $Button1 = GUICtrlCreateButton("Neuer Einrag", 16, 136, 203, 97, 0)
    GUICtrlSetFont(-1, 8, 800, 4, "Tahoma")
    $Button2 = GUICtrlCreateButton("Updates", 16, 256, 203, 97, 0)
    GUICtrlSetFont(-1, 8, 800, 4, "Tahoma")
    $Icon1 = GUICtrlCreateIcon("C:\Programme\AutoIt3\Examples\Meine Programme mit AutoIt\Tuybook\Icon1.ico", 0, 500, 304, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
    $Label1 = GUICtrlCreateLabel("Copyright: TensoX 2007", 456, 344, 120, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
    $Label2 = GUICtrlCreateLabel("Der Viewer zeigt deine Einträge im Tuybook.", 240, 16, 215, 17)
    GUICtrlSetFont(-1, 8, 400, 2, "Tahoma")
    $Label3 = GUICtrlCreateLabel("Erstelle dir einen neuen Eintrag im Tuybook.", 240, 136, 214, 17)
    GUICtrlSetFont(-1, 8, 400, 2, "Tahoma")
    $Label4 = GUICtrlCreateLabel("Sei immer Aktuell mit Tuybook.", 240, 256, 149, 17)
    GUICtrlSetFont(-1, 8, 400, 2, "Tahoma")
    $Label5 = GUICtrlCreateLabel("1.0 beta", 424, 328, 50, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    ; Ende

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

    #Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\bla\desktop\bla\add.kxf
    $Form1_1 = GUICreate("Eintrag im Tuybook", 341, 369, 193, 115)
    $Label1 = GUICtrlCreateLabel("Titel:", 8, 8, 32, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
    $Input1 = GUICtrlCreateInput("", 8, 40, 121, 21)
    GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
    $Label2 = GUICtrlCreateLabel("Text", 8, 72, 30, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
    GUICtrlCreateEdit("", 8, 104, 313, 201)
    GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
    $Button1 = GUICtrlCreateButton("Save", 248, 336, 75, 17, 0)
    GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
    GUISetState()
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    $Form1_1
    EndSwitch
    WEnd

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

    Exit
    ; END GUI

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

    Edit BugFix: Spoiler gesetzt

    Einmal editiert, zuletzt von tince (9. Oktober 2007 um 23:53)

  • Jetzt schliesst sich die Gui 2 nicht :( ..*naja.. so viel erfahrung mit autoit hab ich auch schon wieder nicht*

    • Offizieller Beitrag

    Mal ein Bsp. für 2 GUImit den ID's $gui1 und $gui2

    [autoit]

    While 1
    $msg = GUIGetMsg(1)
    If $msg[0] = $GUI_EVENT_CLOSE Then
    Switch $msg[1]
    Case $gui1 ; Programm beenden
    Exit
    Case $gui2
    GUISetState(@SW_HIDE, $gui2) ; GUI 2 schließen
    EndSwitch
    EndIf
    WEnd

    [/autoit]
  • Okey, hat funktioniert! danke für dein beispiel :) bugfix

    kleine frage: wie kann ich verhindern das die gui2 erst beim klicken auf ein button aufgeht..*

    3 Mal editiert, zuletzt von tince (9. Oktober 2007 um 22:24)

    • Offizieller Beitrag

    Machs so:

    Spoiler anzeigen
    [autoit]

    While 1
    $msg = GUIGetMsg(1)
    Switch $msg[1]
    Case $gui1 ; Programm beenden
    Switch $msg[0]
    Case $GUI_EVENT_CLOSE
    Exit
    Case $btnOpenGUI2
    GUISetState(@SW_SHOW, $gui2)
    GUISetState(@SW_HIDE, $gui1) ; GUI 1 ausblenden
    ; Case andere Controls

    EndSwitch
    Case $gui2
    Switch $msg[0]
    Case $GUI_EVENT_CLOSE
    GUISetState(@SW_HIDE, $gui2) ; GUI 2 schließen
    GUISetState(@SW_SHOW, $gui1) ; GUI 1 einblenden
    ; Case andere Controls

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

    EndSwitch
    EndSwitch
    WEnd

    [/autoit]
  • Hey! Vielen Dank :) Hat funktioniert.. *grins*


    Jetzt kann man glaub close~~

    Das wäre die andere Lösung:

    [autoit]


    While 1
    $msg = GUIGetMsg(1)
    Switch $msg[1]
    Case $Form1_1 ; Programm beenden
    Switch $msg[0]
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    GUISetState(@SW_SHOW, $Form1_2)
    ; Case andere Controls

    EndSwitch
    Case $Form1_2
    Switch $msg[0]
    Case $GUI_EVENT_CLOSE
    GUISetState(@SW_HIDE, $Form1_2) ; GUI 2 schließen
    ; Case andere Controls

    EndSwitch
    EndSwitch
    WEnd

    [/autoit]

    Einmal editiert, zuletzt von tince (9. Oktober 2007 um 23:49)