Re: Safari-like View Change
Re: Safari-like View Change
- Subject: Re: Safari-like View Change
- From: Ryan Stevens <email@hidden>
- Date: Thu, 23 Sep 2004 09:00:18 -0700
On Sep 23, 2004, at 7:14 AM, Kevin Ballard wrote:
Well, yes, you can, but then you have to keep track of indexes for
things that aren't necessarily indexed. In my case, I have a list of
plugins, and a tableview that lets me select the one to show the view
for. The list in the tableview isn't necessarily the same list I have
internally for my plugins (since it can be sorted and there's the
potential of filtering out certain plugins), so instead I access them
by name (which is good because my internal plugin manager uses names
to access the components of the plugin). This would be much more
complicated if I had to use a tab view and access it by index.
[tabView selectTabViewItemWithIdentifier:@"foo"];
Just make sure the NSTabViewItems have unique IDs.
Or you could write a category on NSTabView and go this way...
- (NSTabViewItem *)tabViewItemWithIdentifier:(NSString *)ident
{
int index = [self indexOfTabViewItemWithIdentifier:ident];
return [self tabViewItemAtIndex:index];
}
// ...
id item = [tabView tabViewItemWithIndentifier:anID];
[tabView selectTabViewItem:item];
But yes, I agree, it's possible to use a tab view for a dynamic list,
assuming you can access them by index appropriately.
On Sep 23, 2004, at 10:08 AM, Glenn Andreas wrote:
Yes, I realize this, but if you need to swap views not known about
at design time (such as views loaded from plugins) then you can't
use a tab view.
Why not? It's fairly easy to add views to an NSTabView at runtime as
you load your plugins, and later refer to them via index. About the
only problem you might have is running out of space for the titles
(but if you are using the "no tabs" version this isn't an issue).
_______________________________________________
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