Unable to programmatically add NSTabViewItem(s) to NSTabView
Unable to programmatically add NSTabViewItem(s) to NSTabView
- Subject: Unable to programmatically add NSTabViewItem(s) to NSTabView
- From: "Frederick C. Lee" <email@hidden>
- Date: Tue, 19 Oct 2004 15:38:04 -0700
Greetings:
I'm trying to dynamically (per user selection) add NSTabViewItems to a NSTabView. The user selects multiple images via NSOpenPanel dialog and hopefully, a set of NSTabViewItems are created for the user to view the selection.
I CAN populate the available tabs (say, 10) from tab #1 to tab #10 or a subset of those. I CAN also remove tabs (the unused tabs). But if the user selects MORE images than available tabs, I need to programmatically create extra tabs which I can. *BUT* I CAN NOT populate these new tabs. XCode/IB apparently is unaware of these new tabs and I always get an address error of some kind.
So... I CAN populate EXISTING tabs (containing NSImageViews); but I CAN NOT CREATE NEW TABS AND POPULATE THEM.
The following is that sample code that creates new tabs. I populate the new tabs with the known mapImage1_View, just trying to get this to work.
int const lastReceivedTab = [theMaps count];
int const numberOfTabs = [map_TabView numberOfTabViewItems];
NSNumber *myNum = [[NSNumber alloc] initWithInt:numberOfTabs];
if (lastReceivedTab > numberOfTabs) {
for (k = numberOfTabs; k < lastReceivedTab; k++) {
NSTabViewItem *tabViewItem = [[NSTabViewItem alloc] initWithIdentifier:myNum];
[tabViewItem setView:mapImage1_View];
myNum = [NSNumber numberWithInt:([myNum intValue] + 1)];
[map_TabView addTabViewItem:tabViewItem];
NSLog(@"New Tab count:%i",k);
}
}
Question: Is it possible to programmatically ADD & POPULATE NSTabViewItems or are we stuck with working with pre-defined items via IB?
Thanks!
Ric.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden