R – NSScrollView Bar not scrolling through NSTableView rows

cocoansscrollviewnstableview

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?

Best Answer

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?

Related Topic