Page 1 of 1

Window repaint problem

Posted: Mon Aug 22, 2005 9:13 am
by LuckyLuke
How can I prevent my window from hanging when I use MyLongDurationFunction() ?

Using CreateThread() function ?

Code: Select all

  Open_Window()

  Repeat     
    Event  = WaitWindowEvent()   
    If Event  = #PB_EventGadget     
      GadgetID  = EventGadgetID()    
      If GadgetID = #Create
        MyLongDurationFunction()
      EndIf     
    EndIf   
  Until Event  = #PB_EventCloseWindow 
Thanks.

Re: Window repaint problem

Posted: Mon Aug 22, 2005 9:41 am
by gnozal
LuckyLuke wrote:How can I prevent my window from hanging when I use MyLongDurationFunction() ?

Using CreateThread() function ?

Code: Select all

  Open_Window()

  Repeat     
    Event  = WaitWindowEvent()   
    If Event  = #PB_EventGadget     
      GadgetID  = EventGadgetID()    
      If GadgetID = #Create
        MyLongDurationFunction()
      EndIf     
    EndIf   
  Until Event  = #PB_EventCloseWindow 
Thanks.
You could also use some DoEvents() function in your MyLongDurationFunction() viewtopic.php?t=14492&highlight=doevents, as many PB functions are not thread safe...