ScrollBar arrow dose not decrease

Mac OSX specific forum
Wolfram
Enthusiast
Enthusiast
Posts: 610
Joined: Thu May 30, 2013 4:39 pm

ScrollBar arrow dose not decrease

Post 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
macOS Catalina 10.15.7
User avatar
mk-soft
Always Here
Always Here
Posts: 6554
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ScrollBar arrow dose not decrease

Post 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
My Projects EventDesigner V3 / ThreadToGUI / OOP-BaseClass / Windows: Module ActiveScript
PB v3.30 / v5.75 - OS Mac Mini - VM Window Pro / Linux Ubuntu
Downloads on my OneDrive
User avatar
Shardik
Addict
Addict
Posts: 2076
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: ScrollBar arrow dose not decrease

Post by Shardik »

It's a bug which was already reported by Niffo for Snow Leopard:
http://www.purebasic.fr/english/viewtop ... 24&t=53334
User avatar
Shardik
Addict
Addict
Posts: 2076
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: ScrollBar arrow dose not decrease

Post 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
Post Reply