Multiple Instances of Repeat

Just starting out? Need help? Post your questions and find answers here.
jim.richards
New User
New User
Posts: 4
Joined: Mon Jun 23, 2003 12:31 pm
Location: Kingston, NH

Multiple Instances of Repeat

Post by jim.richards »

Hi All,

Is it possible to have multiple instances of Repeat? I am trying to break out the event handling for a multiple windowed app.

Thanks
Jim
Jim Richards
jrichards@necronline.com
(603) 893-2091
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

without problem.
jim.richards
New User
New User
Posts: 4
Joined: Mon Jun 23, 2003 12:31 pm
Location: Kingston, NH

Re: Multiple Instances

Post by jim.richards »

So I assume it would be handled as follows:

Procedure Window_1
Repeat
Until
EndProcedure

Procedure Window_2
Repeat
Until
EndProcedure

Thanks For Feedback
Jim Richards
jrichards@necronline.com
(603) 893-2091
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Best way to handle multiple windows would be this:

Code: Select all

Repeat
  Event.l = WaitWindowEvent()  ; save the event

  Select EventWindowID()  ; check which window the Event.l was on

    Case 0  
      ; The Event occured on Window 0
      ; 0 is the number you gave the window at OpenWindow(0, ...)

      ; now see what event it was...
      ; so this is the event handling for window 0
      Select Event.l
      
        ; ...
      EndSelect

    Case 1
      ; Event was on Window 1
      ; put event handling for window 1 here

    ; ...

  EndSelect
Until Whatever = Something ; continue until your end cóndition is met
The Events from all windows will arrive here, one at a time, so there is
no need for different loops for all the windows.

Timo
quidquid Latine dictum sit altum videtur
Post Reply