Code Snippet: Better Table Support in NSTextView
Overview
All source is released free of charge. You may incorporate it into any of your applications. I assume no liability for any action that may come from you using this source. If you do use this in your application, I’d like a mention in your about box, but I don’t require it. Don’t forget to drop me an email at warwick@codehackers.net so I know when to stroke my ego.
I’m working on Stone Hill Invoicer, adding some new functionality to the .rtfd editor where users can customize how their invoices print. One of the support emails that pops up once in a while is asking why it’s so hard to add and delete columns to tables. Until now, I’ve just been using a standard NSTextView, so I’ve been apologetic and put it on my list of things to take care of for 2.0.
This post presents some code for a subclass which add in additional contextual menu items to the standard NSTextView menu when over a table. Here are the old and new menus for comparison:
![]() |
![]() |
Download
If you’d like to use this subclass, download the header and implementation files and integrate them into your project. Remember to select your NSTextView in interface builder and change it to a CHTextView. AttributionAll source is released free of charge. You may incorporate it into any of your applications. I assume no liability for any action that may come from you using this source. If you do use this in your application, I’d like a mention in your about box, but I don’t require it. Don’t forget to drop me an email at warwick@codehackers.net so I know when to stroke my ego.

