Re: moving an NSTabViewItem
Re: moving an NSTabViewItem
- Subject: Re: moving an NSTabViewItem
- From: Ken Victor <email@hidden>
- Date: Wed, 29 Mar 2006 17:36:23 -0800
thanx for the reply. it turns out the problem was with the frame(s)
of the items in my second nib. once i realized what the problem was,
i've been able to get it to work by making sure that my NSTabView in
my second nib is located at location 0,0 in the custom view. thus,
your approach would also work, but it would mean copying information
from the second nib's NSTabViewItem to the newly created one (ie, its
label and its identifier).
ken
At 2:23 AM +0100 3/30/06, Mike Abdullah wrote:
Hmm, interesting. I certainly can't claim to be an expert in this
particular area, but I suggest you might try a slightly different
tack to now.
Rather than trying to move the tab view items around, I think you
want to simply create and destroy these programmatically.
You then want to use NSTabViewItem's setView: method to move/copy
the view into the required tab view. Simply keep the view as its
own item in a nib, or even just retrieve it in the first place by
using the view method of NSTabViewItem.
Mike.
On 30 Mar 2006, at 01:49AM, Ken Victor wrote:
i've got a window with an NSTabView with 3 tabs/NSTabViewItems
created in IB. this window displays fine.
now i'd like to be able to programmatically add additional tabs.
i've created another nib file containing a custom view that
contains an NSTabView with 2 tabs. the first tab is the one i want
to move to my original window.
i'm (unsuccessfully) using the following code:
NSTabView* nibTabView = ... // successfully find the NSTabView from
2nd nib file
NSTabViewItem* tvi = [[nibTabView tabViewItemAtIndex: 0] retain];
[nibTabView removeTabViewItem: tvi];
NSTabView* windowTabView = ... // tab view in window that i wish to add to
[windowTabView addTabViewItem: tvi];
[tvi release];
this code successfully shows the new tab (with the appropriate
label), but doesn't display any of the objects from the
NSTabViewItem from the second nib file.
if i insert the line of code as follows:
NSTabView* windowTabView = ...
[windowTabView addSubview: [tvi view]]; // new line of code
[windowTabView addTabViewItem: tvi];
then the subviews from the second nib file show up on the original
first 3 tabs until i click on the newly added tab. the subviews
still don't show up in the newly added tab, but when i then click
back to one of the original 3 tabs, the new subviews no longer show.
can anyone shed some light on what's wrong with the above? or more
to the point, how to programmatically add an IB created
NSTabViewItem from one nib file to a different NSTabView?
thanx,
ken
_______________________________________________
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
_______________________________________________
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