can't hide scrollbar on NSTableView

  • Ok, I'm stumped here. I have a few scrollable views in my window, two
    NSTableViews, and an NSTextView.  I'd like to have the scrollbar to
    hide when not in use, and used the setting of the NSScrollView in IB
    in Xcode to do so.  For the NSTextView it works, but for the
    NSTableViews the scrollbar won't hide, and are also much wider. The
    scrollbar settings are exactly the same for all three NSScrollViews.

    What am I missing here, is there another secret setting?

    (Lion, Xcode 4)

    - Koen.
  • On Jun 4, 2012, at 11:48 AM, Koen van der Drift <koenvanderdrift...> wrote:

    > Ok, I'm stumped here. I have a few scrollable views in my window, two
    > NSTableViews, and an NSTextView.  I'd like to have the scrollbar to
    > hide when not in use, and used the setting of the NSScrollView in IB
    > in Xcode to do so.  For the NSTextView it works, but for the
    > NSTableViews the scrollbar won't hide, and are also much wider. The
    > scrollbar settings are exactly the same for all three NSScrollViews.
    >
    > What am I missing here, is there another secret setting?

    What settings are you referring to?
    By hide, do you mean autohide scrollers when not needed, or not used? The later is also dependent on the OS settings for your mouse.

    corbin

    >
    > (Lion, Xcode 4)
    >
    > - Koen.
  • On Jun 5, 2012, at 7:16 PM, Corbin Dunn wrote:

    >
    > On Jun 4, 2012, at 11:48 AM, Koen van der Drift <koenvanderdrift...> wrote:
    >
    >> Ok, I'm stumped here. I have a few scrollable views in my window, two
    >> NSTableViews, and an NSTextView.  I'd like to have the scrollbar to
    >> hide when not in use, and used the setting of the NSScrollView in IB
    >> in Xcode to do so.  For the NSTextView it works, but for the
    >> NSTableViews the scrollbar won't hide, and are also much wider. The
    >> scrollbar settings are exactly the same for all three NSScrollViews.
    >>
    >> What am I missing here, is there another secret setting?
    >
    > What settings are you referring to?
    > By hide, do you mean autohide scrollers when not needed, or not used? The later is also dependent on the OS settings for your mouse.

    I am referring to "Automatically hide scroller" and "Show vertical scroller", these are both on for all three views.  In the textview the scrollbar behaves as expected, in the tableview, the scrollbar is always visible. The scrollbar on the tableviews has a visible 'gutter' as was the case pre-lion and is also drawn in a slightly lighter shade of gray.  All other apps I use (including the TableViewPlayground code example from Apple) have the expected behavior.

    Here's a screenshot, hope this works:

    http://dl.dropbox.com/u/41198645/Screen%20Shot%202012-06-05%20at%207.36.44%
    20PM.png


    You can see the scrollbar on the right, the 'gutter' and scrollknob are always visible.

    - Koen.
  • On Jun 5, 2012, at 4:44 PM, Koen van der Drift <koenvanderdrift...> wrote:

    >
    > On Jun 5, 2012, at 7:16 PM, Corbin Dunn wrote:
    >
    >>
    >> On Jun 4, 2012, at 11:48 AM, Koen van der Drift <koenvanderdrift...> wrote:
    >>
    >>> Ok, I'm stumped here. I have a few scrollable views in my window, two
    >>> NSTableViews, and an NSTextView.  I'd like to have the scrollbar to
    >>> hide when not in use, and used the setting of the NSScrollView in IB
    >>> in Xcode to do so.  For the NSTextView it works, but for the
    >>> NSTableViews the scrollbar won't hide, and are also much wider. The
    >>> scrollbar settings are exactly the same for all three NSScrollViews.
    >>>
    >>> What am I missing here, is there another secret setting?
    >>
    >> What settings are you referring to?
    >> By hide, do you mean autohide scrollers when not needed, or not used? The later is also dependent on the OS settings for your mouse.
    >
    > I am referring to "Automatically hide scroller" and "Show vertical scroller", these are both on for all three views.  In the textview the scrollbar behaves as expected, in the tableview, the scrollbar is always visible. The scrollbar on the tableviews has a visible 'gutter' as was the case pre-lion and is also drawn in a slightly lighter shade of gray.  All other apps I use (including the TableViewPlayground code example from Apple) have the expected behavior.
    >
    > Here's a screenshot, hope this works:
    >
    > http://dl.dropbox.com/u/41198645/Screen%20Shot%202012-06-05%20at%207.36.44%
    20PM.png

    >
    > You can see the scrollbar on the right, the 'gutter' and scrollknob are always visible.

    It has a scroller there because it has scrollable area.

    All I can guess is that something has some scrollable area or the property is reset somewhere (and you don't expect it to be reset). Also look for non pixel aligned things; things could be off by 0.5 and it might cause a scroller to appear but not scroll anything.

    corbin
  • On Wed, Jun 6, 2012 at 12:42 PM, Corbin Dunn <corbind...> wrote:

    > It has a scroller there because it has scrollable area.

    Yes, but it should hide when I am not scrolling (as was the case when
    taking the screenshot).

    > All I can guess is that something has some scrollable area or the property is reset somewhere (and you don't expect it to be reset). Also look for non pixel aligned things; things could be off by 0.5 and it might cause a scroller to appear but not scroll anything.
    >
    > corbin

    I wonder if it has to do with switching from cell based to view based
    NSTableViews.  I'll look into that later tonight.

    - Koen.
  • On Jun 6, 2012, at 9:54 AM, Koen van der Drift <koenvanderdrift...> wrote:

    > On Wed, Jun 6, 2012 at 12:42 PM, Corbin Dunn <corbind...> wrote:
    >
    >> It has a scroller there because it has scrollable area.
    >
    > Yes, but it should hide when I am not scrolling (as was the case when
    > taking the screenshot).

    Okay; we are talking about two different things!

    Automatically Hide scroller makes it come and go depending on content. But what you are talking about is the NSScrollerStyle of overlay that makes them disappear when nothing is touching them, *and* you have a touch enabled device (track pad, magic mouse,etc). The latter is an option in preferences; make sure you have it set to automatically hide scrollers (or, always hide them, even if you have a regular mouse).

    Just call setScrollerStyle to NSScrollerStyleOverlay to force it on. NSScrollView decides if it can be on or off by default using a special algorithm; you might be tripping it up by having a view that intersects with the scroll area, so you can just force it always to be overlay.

    Hopefully this clears up that property and the difference.

    corbin

    >
    >> All I can guess is that something has some scrollable area or the property is reset somewhere (and you don't expect it to be reset). Also look for non pixel aligned things; things could be off by 0.5 and it might cause a scroller to appear but not scroll anything.
    >>
    >> corbin
    >
    > I wonder if it has to do with switching from cell based to view based
    > NSTableViews.  I'll look into that later tonight.
    >
    > - Koen.
  • On Jun 6, 2012, at 4:51 PM, Corbin Dunn wrote:

    > Just call setScrollerStyle to NSScrollerStyleOverlay to force it on. NSScrollView decides if it can be on or off by default using a special algorithm; you might be tripping it up by having a view that intersects with the scroll area, so you can just force it always to be overlay.

    That doesn't work :(

    I added this:

            NSScrollView *sv = [myTableView enclosingScrollView];
            [sv setScrollerStyle: NSScrollerStyleOverlay];

    In my general preferences I tried both "Automatically based on input device" and "When scrolling".

    - Koen.
  • On Jun 6, 2012, at 4:51 PM, Corbin Dunn wrote:

    > you might be tripping it up by having a view that intersects with the scroll area

    This turned out to be a good suggestion; I made the scrollview a few pixels less wide, and I now get the expected scroll bar behavior, even without calling setScrollerStyle:

    - Koen.
previous month june 2012 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
Go to today