Page 1 of 1

4.02 - Scrollbar gadget not returning event on mouse down

Posted: Tue Sep 18, 2007 7:12 pm
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

Posted: Wed Sep 19, 2007 7:15 pm
by Fred
The scrollbar event is sent when the scrollbar has finished moving.