No events occur during scrolling

Just starting out? Need help? Post your questions and find answers here.
Jeff88
New User
New User
Posts: 8
Joined: Thu Jan 03, 2019 3:05 am

No events occur during scrolling

Post by Jeff88 »

I wrote a pragram and that uses a scroll bar gadget and I wanted to signal when the value it returns changes while scrolling. So I "binded" the scoll bar and had it post an event when its value changed. Fail. Investigating I discovered that while scolling with mouse button depressed no events would occur. Here is a snippet of test code. Normally debug prints "timer" twice a second as expected. But when scolling nothing. When I release the mouse button a whole bunch of "timer" are printed by debug. I infer that the events are posted to the event queue but not being acknowledged by the WaitWindowEvent command until the mouse button is released.

Anyone care to comment.

Code: Select all

AddWindowTimer(0,6,500)         ;many lines of code above this line
  
  Repeat                                ;Main Loop 
    Event = WaitWindowEvent()           ;After plotting wait for window events
    If Event = #PB_Event_CloseWindow
      End
    EndIf
    If event=#PB_Event_Timer
      Debug "timer"
    EndIf
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: No events occur during scrolling

Post by RASHAD »

Hi and welcome to PB

Code: Select all

Procedure scroll1CB()
  Debug GetGadgetState(0)
EndProcedure

Procedure scroll2CB()
  Debug GetGadgetState(1)
EndProcedure
  
If OpenWindow(0, 0, 0, 305, 140, "ScrollBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  TextGadget       (2,  10, 25, 250,  20, "ScrollBar Standard  (start=50, page=30/100)",#PB_Text_Center)
  ScrollBarGadget  (0,  10, 42, 250,  20, 0, 100, 30)
  SetGadgetState   (0,  50)   ; set 1st scrollbar (ID = 0) to 50 of 100
  TextGadget       (3,  10,115, 250,  20, "ScrollBar Vertical  (start=100, page=50/300)",#PB_Text_Right)
  ScrollBarGadget  (1, 270, 10,  25, 120 ,0, 300, 50, #PB_ScrollBar_Vertical)
  SetGadgetState   (1, 100)   ; set 2nd scrollbar (ID = 1) to 100 of 300
  BindGadgetEvent(0,@scroll1CB())
  BindGadgetEvent(1,@scroll2CB())
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Quit = 1

    EndSelect
  Until Quit =1
EndIf
Egypt my love
Post Reply