WaitWindowEvent / WindowEvent problem
Posted: Fri Feb 15, 2008 1:36 pm
For some Operations in Windows, it seems the functions WaitWindowEvent() and WindowEvent() are blocking. In the following example, the WaitWindowEvent() function doesnt timeout anymore if you drag the sliders, keep a button of the sliders clicked, move the window around, open the window system menu or click into the slider area. Using WindowEvent() instead, create basically the same problem. The function doesnt return anymore even though the manual states that it will always return immediately.
I checked the manual, purearea samples and the english forum but couldnt find a solution to this. Verified on two windows xp professional installations with the latest PB 4.10 version.
So my questions are:
- Do i miss something? Is this behaviour intended or a bug?
- if this behaviour is "intended" - how can i make realtime updates to gadgets/areas while the scrollbar is dragged?
- why doesnt the scrollbar give any event while its beeing dragged?
- is longcat really as long as people claim it is?
Using a second thread, the window callback function and a mutex "may" get around this problem, but it feels very dirty and definitely isnt portable.
I checked the manual, purearea samples and the english forum but couldnt find a solution to this. Verified on two windows xp professional installations with the latest PB 4.10 version.
Code: Select all
;- Window Constants
Global Window_Form1
;- Gadget Constants
Enumeration 1
;Window_Form1
Global Gadget_Form1_ScrollBar2
Global Gadget_Form1_ScrollArea3
Global Gadget_Form1_Area4
Global Gadget_Form1_ScrollBar5
EndEnumeration
Procedure.l Window_Form1()
Window_Form1=OpenWindow(#PB_Any,80,80,345,170,"Work Form1",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible)
If Window_Form1
If CreateGadgetList(WindowID(Window_Form1))
Gadget_Form1_ScrollBar2=ScrollBarGadget(#PB_Any,10,10,300,15,0,500,100)
Gadget_Form1_ScrollArea3=ScrollAreaGadget(#PB_Any,10,40,300,115,400,300,5)
CloseGadgetList()
Gadget_Form1_ScrollBar5=ScrollBarGadget(#PB_Any,320,10,15,145,0,500,100,#PB_ScrollBar_Vertical)
HideWindow(Window_Form1,0)
ProcedureReturn WindowID(Window_Form1)
EndIf
EndIf
EndProcedure
;- Main Loop
If Window_Form1()
quitForm1=0
Repeat
EventID =WaitWindowEvent(100)
; Repeat
; EventID = WindowEvent()
; If (EventID = 0)
; Debug "EV Timeout"
; Delay(10)
; EndIf
; Until EventID
If (EventID)
Debug "Event : " + Str(EventID)
MenuID =EventMenu()
GadgetID =EventGadget()
WindowID =EventWindow()
Select EventID
Case #PB_Event_CloseWindow
If WindowID=Window_Form1
quitForm1=1
EndIf
Case #PB_Event_Gadget
Select GadgetID
Case Gadget_Form1_ScrollBar2
Case Gadget_Form1_Area4
Case Gadget_Form1_ScrollBar5
EndSelect
EndSelect
Else
Debug "Event timeout"
EndIf
Until quitForm1
CloseWindow(Window_Form1)
EndIf
End
; IDE Options = PureBasic 4.10 (Windows - x86)
; CursorPosition = 81
; FirstLine = 34
; Folding = -
; EnableThread
; EnableXP
- Do i miss something? Is this behaviour intended or a bug?
- if this behaviour is "intended" - how can i make realtime updates to gadgets/areas while the scrollbar is dragged?
- why doesnt the scrollbar give any event while its beeing dragged?
- is longcat really as long as people claim it is?
Using a second thread, the window callback function and a mutex "may" get around this problem, but it feels very dirty and definitely isnt portable.