Jump to content
Sign in to follow this  
sumit

help required with exitloop

Recommended Posts

sumit

Please run the following code. In this code I want that the main window should not close when message window 1 or message window 2 is closed but i am not able to do it. If i use exitloop then the message 1 and message 2 window dont close at all.

Please help

CODE
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Dialog", 277, 203, 371, 214)

$GroupBox1 = GUICtrlCreateGroup("", 8, 8, 257, 185)

$List1 = GUICtrlCreateList("", 56, 56, 121, 97)

GUICtrlSetData(-1, "do 1|do 2")

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

If GUICtrlRead($List1) = 'do 1' Then

#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\desktop\download accelerator\aform2.kxf

$Form2_1 = GUICreate("AForm2", 230, 98, 374, 319)

$Label1 = GUICtrlCreateLabel("message 1", 64, 40, 65, 17)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$mMsg = GUIGetMsg()

Switch $mMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

EndIf

If GUICtrlRead($List1) = 'do 2' Then

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\Desktop\Download Accelerator\AForm3.kxf

$Form2 = GUICreate("AForm3", 230, 98, 395, 163)

$Label1 = GUICtrlCreateLabel("message 2", 64, 40, 65, 17)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$oMsg = GUIGetMsg()

Switch $oMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

EndIf

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Share this post


Link to post
Share on other sites
Nahuel

Because I'm bored.

This would be a proper way to handle multiple GUI's.

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Dialog", 277, 203, 371, 214)
$GroupBox1 = GUICtrlCreateGroup("", 8, 8, 257, 185)
$List1 = GUICtrlCreateList("", 56, 56, 121, 97)
GUICtrlSetData(-1, "do 1|do 2")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Form2_1 = GUICreate("AForm2", 230, 98, 374, 319)
$Label1 = GUICtrlCreateLabel("message 1", 64, 40, 65, 17)
;~ GUISetState(@SW_SHOW)
$Form2 = GUICreate("AForm3", 230, 98, 395, 163)
$Label1 = GUICtrlCreateLabel("message 2", 64, 40, 65, 17)
;~ GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg(1)
    Switch $nMsg[0]
        Case $List1
            If GUICtrlRead($List1) = 'do 1'  Then GUISetState(@SW_SHOW,$Form2_1)
            If GUICtrlRead($List1) = 'do 2'  Then GUISetState(@SW_SHOW,$Form2)
        Case $GUI_EVENT_CLOSE
            If $nMsg[1]=$Form1 Then Exit
            GUISetState(@SW_HIDE,$nMsg[1])
    EndSwitch

WEnd

Share this post


Link to post
Share on other sites
sumit

Because I'm bored.

This would be a proper way to handle multiple GUI's.

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Dialog", 277, 203, 371, 214)
$GroupBox1 = GUICtrlCreateGroup("", 8, 8, 257, 185)
$List1 = GUICtrlCreateList("", 56, 56, 121, 97)
GUICtrlSetData(-1, "do 1|do 2")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Form2_1 = GUICreate("AForm2", 230, 98, 374, 319)
$Label1 = GUICtrlCreateLabel("message 1", 64, 40, 65, 17)
;~ GUISetState(@SW_SHOW)
$Form2 = GUICreate("AForm3", 230, 98, 395, 163)
$Label1 = GUICtrlCreateLabel("message 2", 64, 40, 65, 17)
;~ GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg(1)
    Switch $nMsg[0]
        Case $List1
            If GUICtrlRead($List1) = 'do 1'  Then GUISetState(@SW_SHOW,$Form2_1)
            If GUICtrlRead($List1) = 'do 2'  Then GUISetState(@SW_SHOW,$Form2)
        Case $GUI_EVENT_CLOSE
            If $nMsg[1]=$Form1 Then Exit
            GUISetState(@SW_HIDE,$nMsg[1])
    EndSwitch

WEnd

Thanks a lot for the help buddy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×