2 GUIs gleichzeitig bedienen

11/27/2010 18:21 maxi39#1
hi,

ich hab vollgendes problem:

PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 469, 78, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 136, 8, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 264, 24, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        case 
$Button1
MsgBox
(0,"","")
        case 
$Button2
_a
()
    EndSwitch
WEnd




Func _a
()

$Form2 = GUICreate("Form1", 200, 200, 200, 200)
GUISetState(@SW_SHOW)









While 
1


    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            GUISetState
(@SW_HIDE,$Form2)
            
ExitLoop


            
EndSwitch






WEnd

    EndFunc 
wenn ich das 2. gui offen habe lässt sich das 1.gui nicht mehr ansprechen. damit meine ich das die funktion mit der msgbox wenn man auf den button drückt net kommt...
11/27/2010 18:25 omer36#2
ehm... doch?!
11/27/2010 18:27 maxi39#3
Quote:
Originally Posted by omer36 View Post
ehm... doch?!
wie?
11/27/2010 18:30 omer36#4
klappt doch ...

die msgbox kommt so oder so..

egal wieviele gui´s du noch öffnest...


ahh, hab nur die hälfte kopiert...

warum zum teufel macht ihr immer 10000000000 zeilenbrüche o.O



so hab ichs zufällig kopiert, und so klappts ;D

PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 469, 78, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 136, 8, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 264, 24, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        case 
$Button1
MsgBox
(0,"","")
        case 
$Button2
_a
()
    EndSwitch
WEnd




Func _a
()
$Form2 = GUICreate("Form1", 200, 200, 200, 200)
GUISetState(@SW_SHOW)
EndFunc 
11/27/2010 18:39 maxi39#5
aba nur weil du die While schleife weggelassen hast, ich möchte noch auf dem 2. gui funktion ausführen
11/27/2010 18:50 omer36#6
Quote:
Originally Posted by maxi39 View Post
aba nur weil du die While schleife weggelassen hast, ich möchte noch auf dem 2. gui funktion ausführen
wenn du mehrere gui´s machen möchtest, machs am besten nach diesem bsp hier:


PHP Code:
$gui1 = GUICreate("erstes fenster")
$button1 = GUICtrlCreateButton("links", 10, 35, 100, 20)
$button2 = GUICtrlCreateButton("rechts", 250, 35, 100, 20)

$gui2 = GUICreate("schritt links")
$button3 = GUICtrlCreateButton("irgentwas", 10, 35, 100, 20)
$zurueck = GUICtrlCreateButton("rechts", 250, 35, 100, 20)

GUISetState(@SW_SHOW, $gui1)

While 
1
    $msg 
= GUIGetMsg(1)
    Switch 
$msg[1]

        Case 
$gui1
            
Switch $msg[0]
                Case -
3
                    
Exit
                Case 
$button1
                    GUISetState
(@SW_HIDE, $gui1)
                    
GUISetState(@SW_SHOW, $gui2)
            EndSwitch

        Case 
$gui2
            
Switch $msg[0]
                Case -
3
                    GUISetState
(@SW_SHOW, $gui1)
                    
GUISetState(@SW_HIDE, $gui2)
                Case 
$button3
                    MsgBox
(0, "", "")
                Case 
$zurueck
                    GUISetState
(@SW_SHOW, $gui1)
                    
GUISetState(@SW_HIDE, $gui2)
            EndSwitch

    EndSwitch
WEnd 
falls du was hier nicht verstehst, frag einfach nach
11/27/2010 19:04 PenGuin :O#7
OnEventModus > Message Loop.