adding a tab view item

I can’t programatically add a new tab view item to my tab view. I tried…

Make new tab view item at end of tab view items of myTabView with properties…

Also I tried using call methods:

call method “addTabViewItem:” of myTabView with parameter “newTabLabel”

But that didn’t work, it seems I need to create a tab view item object before I can add it in this way, so I tried…

set newTabViewObject to call method “alloc” of class “NSTabViewItem”
set initTabViewItem to call method “init” of newTabViewObject
call method “addTabViewItem:” of myTabView with parameter initTabViewItem

But none of those worked… anybody know how to do this?

I saw this post from Mikey-San but it doesn’t seem right, or at least not current. He says it’s a custom class and not part of NSTabView, but I can use call methods from NSTabView to switch between tabs and delete a tab, so I don’t think this is correct any more.

I also tried to make the new tab view item using the initWithIdentifier: but again I couldn’t get it to work…

set newTabViewItem to call method “initWithIdentifier:” of class “NSTabViewItem” with parameter “anIdentifier”
call method “addTabViewItem:” of myTabView with parameter newTabViewItem

Maybe someone with obj-c experience can help me…

I have the idea to use an obj-c class to create the new tab view item since I can’t do it with call methods. So here’s what I’ve got but i get this error message: *** NSMapInsert(): attempt to insert notAKeyMarker

#1) what’s wrong with my code?
#2) what does that terror message mean anyway?

makeNewTabViewItem.h

#import <Cocoa/Cocoa.h>

@interface makeNewTabViewItem : NSTabViewItem
{

}

+(NSTabViewItem *)returnNewTabViewItem;

@end

makeNewTabViewItem.m

#import “makeNewTabViewItem.h”

@implementation makeNewTabViewItem

+(NSTabViewItem *)returnNewTabViewItem
{
NSTabViewItem *newTVI = [[NSTabViewItem alloc] initWithIdentifier:@“myIdent”];
return newTVI;
}

@end

================================================

Then back in applescript I want to say:
set newTVI to call method “returnNewTabViewItem” of class “makeNewTabViewItem”
call method “addTabViewItem:” of objMainTV with parameter newTVI

BUT IT DOESN’T WORK!!! It’s so frustrating. I get that unintelligible error that I have no idea what it means. So any help would be appreciated because it’s just as frustrating as that error to be talking to myself on here.