Anyone managed to get NSTableview display different columns?

I thought I’d have a look into MacOSLib’s implementation of NSTableview – it’s fast and it brings the correct scroll bars with it. Everything nice, except for one thing: I am unable to make it show different columns. A multitude yes, but they all show the same contents (but different headers at least). I’ve been digging into Apple’s developer information, but I must admit I don’t get it. Has anyone of you succeeded in this?

Ulrich,

I am looking at this also now myself. How did you fare on this? I am trying NSTableView so I can possibly implement in row(cell) top/middle vertical alignment.

Thanks!

I made some progress with this a few months ago, however it has only basic support. Here is an example project. Basically in my implementation, you have to create the NSTableColumns using an identifier that represents the column number (so the first column you create is passed “1” the second column in passed “2”, etc. This is used to look up the data in the delegate object, and there is no error checking so passing the correct identifier to the NSTableColumn constructor is critical. My implementation is not subclassed from a canvas like NSControls in MacOSLib but instead through Cocoa.NSView. Although this means you must add it as a subview to a window’s content view, it allows it to be added to popovers and other custom views without nasty hacks. That’s an explanation of the very basics, if you have any questions just ask.

Thank you Jason!

You’re welcome. Hopefully this does at least some of what you are looking for.

I have recently returned to this topic, Mike. I am trying to ged rid of MacOSLib and have own, more lightweight implementations but after 2014r2 the listbox was really fast enough for me, so I put this on low priority. I found out in between the main reason for me being not able to add a row was that in MacOSLib’s NSClassfromString implementation NSTableColumn was commented out :wink:

Thanks a lot for sharing your code, Jason! I’m sure this will be very helpful.