views:

405

answers:

2

Hello,

I currently have an NSTableView inside an NSScrollView and this gets it's contents from a datasource. However, when the number of contents is larger than the view can hold, using the vertical scroll bar does not affect the contents of the table.

  • Dragging the scroll bar doesn't work
  • Clicking the Up/Down buttons doesn't work
  • Using the middle scroll wheel on a mouse does work
  • Using the arrows keys on the keyboard does work
  • The above two move the vertical scrollbar up and down

  • Tried Copy on Scroll On and Off

  • The NSTableView has two columns, one is a text field and the other is an image field

  • No errors appear in the console

This very much seems that the vertical scroll bar is connected to the table view, but only in one direction. That is the tableview changes the scrollbar but not vice versa.

Has anyone had such a problem before? Or know what could be causing it?

A: 

Check the -target of the -verticalScroller (NSScroller) of the NSScrollView. It's probably nil. How did you create the NSScrollView? Have you read over the Scroll View Programming Guide?

Rob Napier
Both the NSTableView and NSScrollView were created by dragging a Table View component from the Interface Builder library.Looking at the bindings of the scroll view and the NSScrollers I can see no connections or bindings relating to a target. In fact there's nothing that links the table and the scrollview visible at all - I assume it's simply done behind the scenes by IB.Unfortunatly my working day is winding down, so I shall have to read the guide tomorrow.
Septih
A: 

The problem here seems to have been caused by the NSTableView being in a NSCollectionView Prototype. I solved it by seperating the NSCollectionViewItem's View from the main nib into it's own so it now has it's own instance and scrolls properly.

Septih
I have the same issue but the NSTableView is not inside an NSCollectionView prototype.
adib
I found the reason why, the scroll bars does exists but they are outside the bounds of the parent window. I found this out accidentally when trying the various border styles of the NSScrollView.
adib