Window repaint problem

Windows specific forum
LuckyLuke
Enthusiast
Enthusiast
Posts: 181
Joined: Fri Jun 06, 2003 2:41 pm
Location: Belgium

Window repaint problem

Post 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.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: Window repaint problem

Post 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...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply