Page 1 of 1
ScrollBar arrow dose not decrease
Posted: Thu May 08, 2014 7:50 pm
by Wolfram
The left ScrollBar arrow dose not decrease the GadGetState.
The right one works, but always two units.
How can I use the left arrow?
How can I step one or four units by using the arrows?
Code: Select all
If OpenWindow(0, 0, 0, 300, 140, "ScrollBarArrow <", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ScrollBarGadget(0, 10, 50, 280, 20 ,0, 300, 50, #PB_ScrollBar_Vertical)
SetGadgetState(0, 125)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 0 : Debug GetGadgetState(0)
EndSelect
EndSelect
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: ScrollBar arrow dose not decrease
Posted: Fri May 09, 2014 2:24 pm
by mk-soft
I think it's a Bug
Code: Select all
Procedure BindGadget0()
Debug "Bind: " + GetGadgetState(0)
EndProcedure
If OpenWindow(0, 0, 0, 300, 140, "ScrollBarArrow <", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ScrollBarGadget(0, 10, 50, 280, 20 ,0, 349, 50, #PB_ScrollBar_Vertical)
SetGadgetState(0, 300)
BindGadgetEvent(0, @BindGadget0(), #PB_All)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Debug "Main: " + GetGadgetState(0)
EndSelect
EndSelect
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: ScrollBar arrow dose not decrease
Posted: Fri May 09, 2014 2:53 pm
by Shardik
It's a bug which was already reported by Niffo for Snow Leopard:
http://www.purebasic.fr/english/viewtop ... 24&t=53334
Re: ScrollBar arrow dose not decrease
Posted: Sat May 10, 2014 3:51 pm
by Shardik
I have programmed the following workaround to enable the use of the currently non-working left arrow. This problem only affects OS X 10.6 (Snow Leopard) and lower because beginning with OS X 10.7 (Lion) the arrows in the ScrollBarGadget (NSScroller) were eliminated from Apple's implementation of the NSScroller:
NSScroller Class Reference wrote:Prior to OS X v10.7, an NSScroller object can also optionally display scroll buttons. The scroll buttons are a pair of buttons that the user can click to scroll by a small amount (called a line increment or decrement) and Alt-click to scroll by a large amount (called a page increment or decrement).
Code: Select all
#NSScrollerDecrementLine = 4
Define KnobPosition.D
Define Point.NSPoint
OpenWindow(0, 270, 100, 300, 140, "ScrollBarGadget")
ScrollBarGadget(0, 10, 60, 280, 20, 0, 300, 50)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
If EventGadget() = 0
Point\x = WindowMouseX(0)
Point\y = WindowHeight(0) - WindowMouseY(0)
If CocoaMessage(0, GadgetID(0), "testPart:@", @Point) = #NSScrollerDecrementLine
SetGadgetState(0, GetGadgetState(0) - 5)
EndIf
Debug "GetGadgetState(0) = " + GetGadgetState(0)
EndIf
EndSelect
ForEver