NSAlert with NSTableview in it size issues

309 Views Asked by At

I have an NSAlert and I set its accessoryView to be an NSTableView. It works good with small-medium amounts of data, but when the row count is getting large, the tableview resizes instead of getting a scrollbar. I would expect the table to only take up as much space as I give it in the Init frame.

 var alert = NSAlert()
 var sampleTable = NSTableView(frame: NSRect(x: 0, y:0, width: 400, height:400))
 sampleTable.dataSource = self
 alert.accessoryView = sampleTable
 alert.beginSheetModal(...) // irrelevant code from here on
1

There are 1 best solutions below

0
Sentry.co On

Set the scrolliew.autohidesScrollers = false and scrollView.hasHorizontalScroller = true where scrollView is an NSScrollView instance