Page 1 of 1

Strange result from WaitWindowEvent?

Posted: Fri Nov 03, 2006 8:44 am
by omit59
Hello You PureBasic gurus!!l!

I found this when my program crashed (v.4.01) but this is same in v.4.0.
WaitWindowEvent() gives message no:280 when SetActiveGadget() is used (with EditorGadget and StringGadget).

Is this normal, or do I just understand something wrong...please help!

Code: Select all

  If OpenWindow(0, 0, 0, 322, 250, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0)) 
    EditorGadget(1, 8, 8, 306, 100)
    StringGadget(2, 8, 120, 306, 100, "Text") 
 
    For a = 0 To 5 
      AddGadgetItem(1, a, "Line "+Str(a)) 
    Next 

    SetActiveGadget(2)

    Repeat 
    
      event = WaitWindowEvent()
    
    Debug event
    
    Until event = #PB_Event_CloseWindow 

  EndIf 
Timo

Posted: Fri Nov 03, 2006 9:01 am
by Michael Vogel
Started the code here (w.&w.o. debugger), no crash, no error! (PB4.01)

Posted: Fri Nov 03, 2006 9:02 am
by waldschrath
You can find some Info about this Message here: http://support.microsoft.com/?id=108938

Posted: Fri Nov 03, 2006 9:30 am
by omit59
Thanks for info!

Well, program didn't crash in v.4.0, it worked all right, but I didn't even notice that event, until I had problems with v.4.01.
My program updates statusbar in main loop, and it started flashing with some other problems as well, so I put debug event in main loop, and even whole IDE crashed.. (cannot confirm now Iam at work).

Timo

Posted: Fri Nov 03, 2006 2:51 pm
by omit59
OK! Here's one more.
This works for me in v.4.0 but in v.4.01 it crashes IDE (debugger on).
Events happen all the time...

Code: Select all

If OpenWindow(0, 100, 150, 300, 100, "PureBasic - StatusBar Example", #PB_Window_SystemMenu | #PB_Window_SizeGadget)

  If CreateStatusBar(0, WindowID(0))
    AddStatusBarField(100)
  EndIf

  StatusBarText(0, 0, "Area 1")
      
  Repeat

  event = WaitWindowEvent()
  Debug event
  
  StatusBarText(0, 0, Str(Date()))
  
  Until event = #PB_Event_CloseWindow
  
EndIf 
Help, please!

Timo

Posted: Fri Nov 03, 2006 3:13 pm
by technicorn
That's a new bug in the IDE V4.01,
if there are still Debug messages to be written to the Debug Output window
and you kill the program from the IDE, the IDE crashes.

Same program doesn't crash in V4.00

As the IDE is written in PB and the new Thread-library no longer returns the thread ID when using CreateThread(),
but instead you have to use ThreadID().

This might be the problem here, if the debugger is started as a thread,
and kill program uses the returnvalue of CreateThread() to kill the debugger thread.