Jump to content

Loop problem


ajit
 Share

Recommended Posts

Hi

I have a do... Until loop inside a While loop. When Do Until loop is in progress (Case $Count) the GUI is nonresponsive. Is it possible to recieve GUI messages such as $GUI_EVENT_CLOSE when Do..Until loop is in progress.

Please help me.

Thanking in anticipation.

Ajit

;;;;;;;;;;;code;;;;;;;;;;;;

$i=1

While 1

Switch GUIGetMsg()

Case $GUI_EVENT_CLOSE

Exit

Case $Count

Do

MsgBox(0, "Value of $i is:", $i)

$i = $i + 1

Until $i = 100

EndSwitch

WEnd

Link to comment
Share on other sites

Maybe,,,

Local $i = 1, $Looper

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Count
            $Looper = 1

    EndSwitch

    If $Looper Then
        MsgBox(0, "Value of $i is:", $i)
        $i = $i + 1
        If $i >= 100 Then
            $i = 1
            $Looper = 0
        EndIf
    EndIf

WEnd

... Otherwise, you can set to OnEventMode()

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Not sure exactly what you are trying to accomplish here, but you would still need to be receiving gui messages in order to catch a close event. Of course doing it this way you will lose any messages other than $GUI_EVENT_CLOSE that might be sent. If you post your full code, we may be able to suggest a better way to accomplish this.

$i=1

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Count
            Do
                If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
                MsgBox(0, "Value of $i is:", $i)
                $i = $i + 1
            Until $i = 100
    EndSwitch
WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...