Real Software Forums
http://forums.realsoftware.com/

Scrollbar visible settings in Mountain Lion
http://forums.realsoftware.com/viewtopic.php?f=7&t=47614
Page 1 of 1

Author:  paul85 [ Tue Apr 16, 2013 5:26 pm ]
Post subject:  Scrollbar visible settings in Mountain Lion

In System Preferences -> General there is an option for "Show scroll bars"

Is it possible to get the selected option here or if scrollbars should be shown based on the user's settings?

Thanks,

Author:  rowlands [ Thu May 02, 2013 10:02 pm ]
Post subject:  Re: Scrollbar visible settings in Mountain Lion

paul85 wrote:
In System Preferences -> General there is an option for "Show scroll bars"

Is it possible to get the selected option here or if scrollbars should be shown based on the user's settings?

Thanks,

It should be possible to access this using defaults terminal command or a declare, my question however is what do you want to do with that information?

If you are using Cocoa, the scrollbars automatically obey this setting, from my understanding there is a feedback request for the listbox to follow this behavior too. If you are creating your own custom view, there is a feedback request for a ScrollView, which again will automagically obey this setting.

Author:  paul85 [ Thu May 02, 2013 10:59 pm ]
Post subject:  Re: Scrollbar visible settings in Mountain Lion

Thanks Sam.

I'm using a custom canvas that needs scrollbars to scroll it's contents.

Do you happen to know the declares or terminal commands?

Author:  rowlands [ Fri May 03, 2013 1:52 am ]
Post subject:  Re: Scrollbar visible settings in Mountain Lion

paul85 wrote:
Thanks Sam.

I'm using a custom canvas that needs scrollbars to scroll it's contents.

Do you happen to know the declares or terminal commands?

Hi Paul,

So I looked it up, it requires 10.7+ while I've wrapped this code in a Try statement, please use another way to check also.

Try
declare function NSClassFromString lib "Cocoa" (aClassName as CFStringRef) as Ptr
// This requires 10.7 or higher
// + (NSScrollerStyle)preferredScrollerStyle
soft declare function preferredScrollerStyle lib "Cocoa" selector "preferredScrollerStyle" ( classRef as Ptr ) as integer
Dim scrollerStyle as integer = preferredScrollerStyle( NSClassFromString( "NSScroller" ) )

const NSScrollerStyleLegacy = 0
const NSScrollerStyleOverlay = 1

select case scrollerStyle
case NSScrollerStyleLegacy
MsgBox "Use the old scroll bars"

case NSScrollerStyleOverlay
MsgBox "Use the 10.7 ""Overlay"" scroll bars."

end select

end try


Basically I ask the NSScroller class which is the 'Preferred Style' and then compare against the constants. I would also recommend signing on to the feature request for a proper Scroll View as this will make your life a lot easier in the future.

[url]<feedback://showreport?report_id=16134>[/url]

Author:  paul85 [ Sat May 04, 2013 6:20 pm ]
Post subject:  Re: Scrollbar visible settings in Mountain Lion

Hi Sam,

Thanks a lot for the code.

Author:  rowlands [ Sat May 04, 2013 9:19 pm ]
Post subject:  Re: Scrollbar visible settings in Mountain Lion

paul85 wrote:
Hi Sam,

Thanks a lot for the code.

You're welcome.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/