How to customized scrallbar?
Posted: Sun May 29, 2016 2:18 pm
Hello,
does anyone know how to built a customized scrallbar with cocoa?
I found some links but can't translate it :-/
http://stackoverflow.com/questions/1967 ... with-cocoa
https://bitbucket.org/bwalkin/bwtoolkit ... ew-default
Thanks for any help
does anyone know how to built a customized scrallbar with cocoa?
I found some links but can't translate it :-/
http://stackoverflow.com/questions/1967 ... with-cocoa
https://bitbucket.org/bwalkin/bwtoolkit ... ew-default
Code: Select all
OpenWindow( 0, 0, 0, 200, 200, "Custom Scrollbar", #PB_Window_ScreenCentered | #PB_Window_SystemMenu )
Global *MyWindow = WindowID(0)
Global Frame.NSRect
Frame\origin\x = 10
Frame\origin\y = 50
Frame\size\width = 180
Frame\size\height = 25
Global MyScroller
CocoaMessage( @MyScroller, #Null, "NSScroller alloc" )
Debug "MyScroller address: " + MyScroller
Global MyKnob
MyKnob = ImageID( CreateImage(#PB_Any, 500, 500, 32, RGB(23, 111, 165)) )
CocoaMessage( 0, MyScroller, "initWithFrame:@", @Frame )
Global Frame.NSRect
CocoaMessage( @Frame, MyScroller, "frame" )
Global p.NSPoint
p\x =0 : p\y =0
Global Rect.NSRect
Rect\origin\x =0
Rect\origin\y =0
Rect\size\width =500
Rect\size\height =500
#NSCompositeSourceOver =2
Global delta.f =1.0
NSZeroRect.NSRect
NSZeroRect\origin\x =0
NSZeroRect\origin\y =0
NSZeroRect\size\width =0
NSZeroRect\size\height =0
CocoaMessage(0, MyKnob, "drawAtPoint:", @p, "fromRect:", @NSZeroRect, "operation:", #NSCompositeSourceOver, "fraction:", @delta)
Global View
CocoaMessage( @View, *MyWindow, "contentView" )
CocoaMessage(0, View, "addSubview:", MyScroller )
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver