4.02 - Scrollbar gadget not returning event on mouse down

Just starting out? Need help? Post your questions and find answers here.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

4.02 - Scrollbar gadget not returning event on mouse down

Post by Mistrel »

Unlike other controls the scrollbar gadget isn't returning an event on mouse down. This makes it difficult to know when the scrollbar is actually being activated.

If you click on one of the buttons you'll see that on mouse up two events are returned. I'm assuming that the mouse down event is being sent with the mouse up instead of mouse down?

Code: Select all

If OpenWindow(0, 0, 0, 305, 140, "ScrollBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
	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
	Repeat
		event=WaitWindowEvent()
		eventgadget=EventGadget()
		If event=#PB_Event_Gadget And eventgadget=0
			Debug 1
		EndIf
		If event=#PB_Event_Gadget And eventgadget=1
			Debug 2
		EndIf
	Until event=#PB_Event_CloseWindow
EndIf
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

The scrollbar event is sent when the scrollbar has finished moving.
Post Reply