2 While Schleifen - Problem

12/24/2012 22:41 Τits ⇒ ω#1
Abend epvp,

ich hab 2 GuiCreate Forms. $Form1 auf @SW_SHOW und $Form2 auf HIDE.

Damit $Form1 sich schließst und $Form2 sich öffnet wenn ich einen Button in $Form1 drücke, hab ichs so:

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
GUISetState(@SW_HIDE, $Form1)
GUISetState(@SW_SHOW, $Form2)
EndSwitch
WEnd



Ich brauche aber bei $Form2 noch eine andere While Schleife.
Wenn ich diese jedoch ans Ende von und $Form2 hänge, will die andere While Schleife nichtmehr. Wie kann ich das am besten lösen?

Danke schonmal!
12/24/2012 23:30 omer36#2
z. B. so

PHP Code:
#include <GUIConstants.au3>

$gui1 GUICreate("erstes fenster")
$button1 GUICtrlCreateButton("links"103510020)
$buttonklick1 GUICtrlCreateButton("klick"2503510020)

$gui2 GUICreate("schritt links")
$buttonklick2 GUICtrlCreateButton("klick"103510020)
$zurueck GUICtrlCreateButton("rechts"2503510020)

GUISetState(@SW_SHOW$gui1)

While 
1
    $msg 
GUIGetMsg(1)
    Switch 
$msg[1]
        Case 
$gui1
            
Switch $msg[0]
                Case 
$GUI_EVENT_CLOSE
                    
Exit
                Case 
$buttonklick1
                    MsgBox
(0"""gui1")
                Case 
$button1
                    GUISetState
(@SW_HIDE$gui1)
                    
GUISetState(@SW_SHOW$gui2)
            EndSwitch
        Case 
$gui2
            
Switch $msg[0]
                Case 
$GUI_EVENT_CLOSE
                    GUISetState
(@SW_SHOW$gui1)
                    
GUISetState(@SW_HIDE$gui2)
                Case 
$buttonklick2
                    MsgBox
(0"""gui2")
                Case 
$zurueck
                    GUISetState
(@SW_SHOW$gui1)
                    
GUISetState(@SW_HIDE$gui2)
            EndSwitch
    EndSwitch
WEnd 
12/24/2012 23:59 Τits ⇒ ω#3
Quote:
Originally Posted by omer36 View Post
z. B. so

Funktioniert leider nicht ganz bei mir.
""Wend" statement with no matching "While" statement."

Ich versuch die beiden zusammen zu fassen:

Für $Form1:
PHP Code:
While 1
   $nMsg 
GUIGetMsg()
   Switch 
$nMsg
      
Case $GUI_EVENT_CLOSE
         
Exit
      Case 
$Button2
         GUISetState
(@SW_HIDE$Form1)
         
GUISetState(@SW_SHOW$Form2)
EndSwitch
WEnd 

Für $Form2:
PHP Code:
While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        Case 
$Button1
            $PH2 
0
            
do
            
$PH2 $PH2 10
            sleep
(800)
            
guictrlsetdata($Progress1 $PH2)
            
until $PH2 100
            sleep
(3000)
            
GUISetState()
    EndSwitch
WEnd 

Danke!
12/25/2012 01:16 BladeTiger12#4
Code:
While 1
   $nMsg = GUIGetMsg(1)
   Switch $nMsg[1]

	Case $Form1
      Case $GUI_EVENT_CLOSE
         Exit
      Case $Button2
         GUISetState(@SW_HIDE, $Form1)
         GUISetState(@SW_SHOW, $Form2)

	 Case $Form2
		  Case $GUI_EVENT_CLOSE
			Exit
			Case $Button1
            $PH2 = 0
            do
            $PH2 = $PH2 + 10
            sleep(800)
            guictrlsetdata($Progress1 , $PH2)
            until $PH2 = 100
            sleep(3000)
            GUISetState()
EndSwitch
WEnd
So dürfte es gehen.
12/25/2012 01:23 Τits ⇒ ω#5
Quote:
Originally Posted by BladeTiger12 View Post

Geht leider nicht, beim Button von $Form1 passiert nichts mehr.
12/25/2012 01:57 BladeTiger12#6
Das volle script wäre schon :).
12/25/2012 03:04 Τits ⇒ ω#7
Quote:
Originally Posted by BladeTiger12 View Post
Das volle script wäre schon :).
Kann ich dich auf Skype adden?
12/25/2012 11:38 omer36#8
PHP Code:
While 1
    $msg 
GUIGetMsg(1)
    Switch 
$msg[1]
        Case 
$Form1
            
Switch $msg[0]
              Case 
$GUI_EVENT_CLOSE
                 
Exit
              Case 
$Button2
                 GUISetState
(@SW_HIDE$Form1)
                 
GUISetState(@SW_SHOW$Form2)
            EndSwitch
        Case 
$Form2
            
Switch $msg[0]
                Case 
$GUI_EVENT_CLOSE
                    
Exit
                Case 
$Button1
                    $PH2 
0
                    
do
                    
$PH2 $PH2 10
                    sleep
(800)
                    
guictrlsetdata($Progress1 $PH2)
                    
until $PH2 100
                    sleep
(3000)
                    
GUISetState()
            EndSwitch
    EndSwitch
WEnd