2 GUIs in einem Script, problem...

12/07/2010 16:35 RettAss#1
Ich bins mal wieder^^, hoffe nerve nicht zu sehr^^, aber ihr seit immernoch die beste hilfe.

Also möchte das sich nur die erste GUI öffnet und mit klick auf $Start sich die GUI schließt und sich die 2. GUI öffnet. Hab schon etliche seiten durchgeforstet, hab zwar auch viel bsp. gefunden, nur konnte es net auf mein script umsetzen, bekomme immer ein fehler mit der declaration von $Fenster.

PHP Code:
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=c:\users\tobi112\desktop\settings.kxf
Global $Settings = GUICreate("Einstellungen", 427, 572, 383, 150)
GUISetBkColor(0xA6CAF0)
Global 
$Start = GUICtrlCreateButton("Start", 160, 520, 97, 41, $WS_GROUP)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
Global 
$ud_1 = GUICtrlCreateLabel("Erstelle deine eigene Airline", 80, 8, 270, 28)
GUICtrlSetFont(-1, 15, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
Global 
$ud_2 = GUICtrlCreateLabel("Wähle deinen Heimatflughafen:", 0, 64, 190, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
Global 
$ud_3 = GUICtrlCreateLabel("Besitzer der Airline:", 72, 120, 118, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
Global 
$ud_4 = GUICtrlCreateLabel("Budget:", 136, 176, 50, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
Global 
$ud_5 = GUICtrlCreateLabel("Name der Airline:", 80, 232, 107, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
Global 
$ud_6 = GUICtrlCreateLabel("Art der Airline:", 104, 288, 86, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
Global 
$ip_airport = GUICtrlCreateInput("", 208, 64, 161, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$WS_BORDER,$WS_CLIPSIBLINGS), 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetBkColor(-1, 0xE3E3E3)
Global 
$ip_besitzer = GUICtrlCreateInput("", 208, 119, 161, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$WS_BORDER,$WS_CLIPSIBLINGS), 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetBkColor(-1, 0xE3E3E3)
Global 
$ip_name = GUICtrlCreateInput("", 208, 234, 161, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$WS_BORDER,$WS_CLIPSIBLINGS), 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetBkColor(-1, 0xE3E3E3)
Global 
$cb_Budget = GUICtrlCreateCombo("", 208, 176, 161, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_OEMCONVERT,$WS_BORDER,$WS_CLIPSIBLINGS))
GUICtrlSetData(-1, "100000000|250000000|500000000")
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
Global 
$cb_art = GUICtrlCreateCombo("", 208, 288, 161, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Cargo|Personen")
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
Global 
$ud_7 = GUICtrlCreateLabel("Oder du hast schon eine Airline", 64, 416, 301, 28)
GUICtrlSetFont(-1, 15, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
Global 
$ud_8 = GUICtrlCreateLabel("Dann Klicke auf Start ohne die Felder auszufüllen", 8, 456, 292, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
Global 
$ud_9 = GUICtrlCreateLabel("und gehe auf Datei --->Öffnen", 8, 480, 176, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUISetState(@SW_SHOW)


While 
1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Case $Start
                    GUISetState
(@SW_HIDE, $Settings)
                    
GUISetState(@SW_SHOW, $Fenster)
    EndSwitch
Wend


Global $Fenster = GUICreate("Airlinemanager ", 901, 675, 0, 0)
Global 
$MenuItem1 = GUICtrlCreateMenu("&Datei")
Global 
$MenuItem4 = GUICtrlCreateMenuItem("Öffnen", $MenuItem1)
Global 
$MenuItem3 = GUICtrlCreateMenuItem("Speichern unter....", $MenuItem1)
Global 
$MenuItem2 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
Global 
$MenuItem5 = GUICtrlCreateMenu("&Credits") 
So na da bin ich mal gespannt, wie man das richtig einbaut, danke schonmal im vorraus

Mfg
12/07/2010 16:43 Kamyshin#2
1.Warum setzt du deine Variablen alle Global? Brauchst du
2.
Musst duch vorher erstellen, bevor die while schleife kommt
3.Dann sollte das doch eh schon alles funzen...
4.Kannst du anstatt hide auch FormDelete benutzen (glaub das hieß so)
12/07/2010 16:53 RettAss#3
Quote:
Originally Posted by Kamyshin View Post
1.Warum setzt du deine Variablen alle Global? Brauchst du
2.
Musst duch vorher erstellen, bevor die while schleife kommt
3.Dann sollte das doch eh schon alles funzen...
4.Kannst du anstatt hide auch FormDelete benutzen (glaub das hieß so)
über das Global kann ich auch nix sagen, hat koda so da gestellt, viel. hab ich auch nur was falsches angeklickt, ka

Wenn ich das 2. GUI über die Whil schleife setzte öffnen sich beide GUIs am anfang und das 2. lässt sich nichtmehr schließen, aber möchte gerne, das sich erst das erste öfnet und mit $Start sich das erste beendet und das 2. öffnet.
12/07/2010 16:54 omer36#4
PHP Code:
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=c:\users\tobi112\desktop\settings.kxf
$Settings = GUICreate("Einstellungen", 427, 572, 383, 150)
GUISetBkColor(0xA6CAF0)
$Start = GUICtrlCreateButton("Start", 160, 520, 97, 41, $WS_GROUP)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$ud_1 = GUICtrlCreateLabel("Erstelle deine eigene Airline", 80, 8, 270, 28)
GUICtrlSetFont(-1, 15, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_2 = GUICtrlCreateLabel("Wähle deinen Heimatflughafen:", 0, 64, 190, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_3 = GUICtrlCreateLabel("Besitzer der Airline:", 72, 120, 118, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_4 = GUICtrlCreateLabel("Budget:", 136, 176, 50, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_5 = GUICtrlCreateLabel("Name der Airline:", 80, 232, 107, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_6 = GUICtrlCreateLabel("Art der Airline:", 104, 288, 86, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ip_airport = GUICtrlCreateInput("", 208, 64, 161, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$WS_BORDER,$WS_CLIPSIBLINGS), 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetBkColor(-1, 0xE3E3E3)
$ip_besitzer = GUICtrlCreateInput("", 208, 119, 161, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$WS_BORDER,$WS_CLIPSIBLINGS), 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetBkColor(-1, 0xE3E3E3)
$ip_name = GUICtrlCreateInput("", 208, 234, 161, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$WS_BORDER,$WS_CLIPSIBLINGS), 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetBkColor(-1, 0xE3E3E3)
$cb_Budget = GUICtrlCreateCombo("", 208, 176, 161, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_OEMCONVERT,$WS_BORDER,$WS_CLIPSIBLINGS))
GUICtrlSetData(-1, "100000000|250000000|500000000")
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$cb_art = GUICtrlCreateCombo("", 208, 288, 161, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Cargo|Personen")
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_7 = GUICtrlCreateLabel("Oder du hast schon eine Airline", 64, 416, 301, 28)
GUICtrlSetFont(-1, 15, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_8 = GUICtrlCreateLabel("Dann Klicke auf Start ohne die Felder auszufüllen", 8, 456, 292, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_9 = GUICtrlCreateLabel("und gehe auf Datei --->Öffnen", 8, 480, 176, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

#Region ### START Koda GUI section ###
$Fenster = GUICreate("Airlinemanager ", 901, 675, 0, 0)
$MenuItem1 = GUICtrlCreateMenu("&Datei")
$MenuItem4 = GUICtrlCreateMenuItem("Öffnen", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Speichern unter....", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenu("&Credits")
#EndRegion ### END Koda GUI section ###


While 1
    $msg 
= GUIGetMsg(1)
    Switch 
$msg[1]
        Case 
$Settings
            
Switch $msg[0]
                Case  -
3
                    
Exit
                Case 
$Start
                    GUISetState
(@SW_HIDE, $Settings)
                    
GUISetState(@SW_SHOW, $Fenster)
            EndSwitch ;
bis hierhin ist das neue ERSTE gui.

        Case 
$Fenster ;ab hier deine ZWEITE gui...
            Switch 
$msg[0]
                Case  -
3
                    GUISetState
(@SW_SHOW, $Settings)
                    
GUISetState(@SW_HIDE, $Fenster)
            EndSwitch ; 
bis hierhin
    
EndSwitch
WEnd 
12/07/2010 17:07 RettAss#5
Quote:
Originally Posted by omer36 View Post
PHP Code:
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=c:\users\tobi112\desktop\settings.kxf
$Settings = GUICreate("Einstellungen", 427, 572, 383, 150)
GUISetBkColor(0xA6CAF0)
$Start = GUICtrlCreateButton("Start", 160, 520, 97, 41, $WS_GROUP)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$ud_1 = GUICtrlCreateLabel("Erstelle deine eigene Airline", 80, 8, 270, 28)
GUICtrlSetFont(-1, 15, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_2 = GUICtrlCreateLabel("Wähle deinen Heimatflughafen:", 0, 64, 190, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_3 = GUICtrlCreateLabel("Besitzer der Airline:", 72, 120, 118, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_4 = GUICtrlCreateLabel("Budget:", 136, 176, 50, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_5 = GUICtrlCreateLabel("Name der Airline:", 80, 232, 107, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_6 = GUICtrlCreateLabel("Art der Airline:", 104, 288, 86, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ip_airport = GUICtrlCreateInput("", 208, 64, 161, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$WS_BORDER,$WS_CLIPSIBLINGS), 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetBkColor(-1, 0xE3E3E3)
$ip_besitzer = GUICtrlCreateInput("", 208, 119, 161, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$WS_BORDER,$WS_CLIPSIBLINGS), 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetBkColor(-1, 0xE3E3E3)
$ip_name = GUICtrlCreateInput("", 208, 234, 161, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$WS_BORDER,$WS_CLIPSIBLINGS), 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetBkColor(-1, 0xE3E3E3)
$cb_Budget = GUICtrlCreateCombo("", 208, 176, 161, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_OEMCONVERT,$WS_BORDER,$WS_CLIPSIBLINGS))
GUICtrlSetData(-1, "100000000|250000000|500000000")
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$cb_art = GUICtrlCreateCombo("", 208, 288, 161, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Cargo|Personen")
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_7 = GUICtrlCreateLabel("Oder du hast schon eine Airline", 64, 416, 301, 28)
GUICtrlSetFont(-1, 15, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_8 = GUICtrlCreateLabel("Dann Klicke auf Start ohne die Felder auszufüllen", 8, 456, 292, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$ud_9 = GUICtrlCreateLabel("und gehe auf Datei --->Öffnen", 8, 480, 176, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

#Region ### START Koda GUI section ###
$Fenster = GUICreate("Airlinemanager ", 901, 675, 0, 0)
$MenuItem1 = GUICtrlCreateMenu("&Datei")
$MenuItem4 = GUICtrlCreateMenuItem("Öffnen", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Speichern unter....", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenu("&Credits")
#EndRegion ### END Koda GUI section ###


While 1
    $msg 
= GUIGetMsg(1)
    Switch 
$msg[1]
        Case 
$Settings
            
Switch $msg[0]
                Case  -
3
                    
Exit
                Case 
$Start
                    GUISetState
(@SW_HIDE, $Settings)
                    
GUISetState(@SW_SHOW, $Fenster)
            EndSwitch ;
bis hierhin ist das neue ERSTE gui.

        Case 
$Fenster ;ab hier deine ZWEITE gui...
            Switch 
$msg[0]
                Case  -
3
                    GUISetState
(@SW_SHOW, $Settings)
                    
GUISetState(@SW_HIDE, $Fenster)
            EndSwitch ; 
bis hierhin
    
EndSwitch
WEnd 
Geht soweit super danke, bis auf das, dass sich am anfang beide GUIs öffnen
12/07/2010 17:10 omer36#6
stimmt, was vergessen, wobei du dir das vllt auch denken könntest/müsstest...

;;;
;;
$MenuItem2 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenu("&Credits")
GUISetState(@SW_HIDE) ;vergessen, unter der 2. gui
12/07/2010 17:16 RettAss#7
Stimmt ja, das 2. GUI war auch nur zur hälfte drauf, habs mir beim zusammenbaun schon irg. wie gedacht aus _Show _hide zu machen, trotzdem vielen dank für die hilfe, aber glaube den satz werd ich hier noch offt gebrauchen :D