Strange result from WaitWindowEvent?

Just starting out? Need help? Post your questions and find answers here.
omit59
User
User
Posts: 63
Joined: Fri Mar 11, 2005 8:41 am
Location: Finland

Strange result from WaitWindowEvent?

Post 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
User avatar
Michael Vogel
Addict
Addict
Posts: 2806
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post by Michael Vogel »

Started the code here (w.&w.o. debugger), no crash, no error! (PB4.01)
waldschrath
New User
New User
Posts: 8
Joined: Fri Nov 03, 2006 8:58 am

Post by waldschrath »

You can find some Info about this Message here: http://support.microsoft.com/?id=108938
omit59
User
User
Posts: 63
Joined: Fri Mar 11, 2005 8:41 am
Location: Finland

Post 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
omit59
User
User
Posts: 63
Joined: Fri Mar 11, 2005 8:41 am
Location: Finland

Post 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
technicorn
Enthusiast
Enthusiast
Posts: 105
Joined: Wed Jan 18, 2006 7:40 pm
Location: Hamburg

Post 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.
Post Reply