Programatically Adding Tab View Items

I’m trying to implement a fairly simple tabbed text editor using PSMTabBarControl. To do so, I need to be able to add tab view items to a tab view, set their applescript name and title, and add a text view to them. Adding the text view can be achieved simply enough, but I can’t figure out how to add tab view items. I tried

make new tab view item at end of tab view items of tab view "tabview" of window "main" with properties {name: "newtab", label: "Demo"}

Which didn’t work. I also looked into using call method and “addTabViewItem:”, which may do the trick. Unfortunately, I’ve been struggling with the syntax for the past half hour, and have yet to get anything but errors in the log and a great variety of error messages. If anyone knows how to add tab view items programatically, either through Applescript or Cocoa, I’d be immensely appreciative of any assistance.

There is no scripting support in these custom classes, and they are not subclasses of NSTabView. Therefore, they do not understand your tab view command. See the documentation for this:

PSMTabBarControl is a subclass of NSControl, which doesn’t know anything about NSTabView.

If you want to use this, you will need to use Cocoa and Interface Builder. From the readme:

To add this to an existing view programmatically, use -[PSMTabBarControl -initWithFrame:] as you would with any other NSView (and then set up your delegate and connections appropriately).