Re: changing a single row in NSOutlineView to different control
Re: changing a single row in NSOutlineView to different control
- Subject: Re: changing a single row in NSOutlineView to different control
- From: Apparao <email@hidden>
- Date: Fri, 21 Jul 2006 15:09:10 +0530
I think, we can implement this by implementing NSTableView's delegate
method named:
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)
aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
This method Informs the delegate that aTableView will display the
cell at rowIndex in aTableColumn using aCell.
- Apparao
On 21-Jul-06, at 10:48 AM, John Terranova wrote:
On Jul 20, 2006, at 7:25 PM, Ender Wiggins wrote:
Hey all,
I have an NSOutlineView already populated with data but now I'd like
to change one of the rows in one of the columns with an
NSPopUpButtonCell. This all happens in a class 'MyOutlineDataSource'
which contains the required outline methods.
Short answer: in NSTableColumn.h use
- (id)dataCellForRow:(int)row;
Does this sound right ... do I need to just create a new class (my
delegate) inherited from NSObject and in IB make the NSOutlineView
point to the new delegate class by setting the custom class tab?
Doing this will change the class of the outline view and would only
work if your new class inherits from NSOutlineView. But it won't
help you solve your problem very well, anyway.
I
think I understand that part, but then, I'm not sure what delegate
method I need to call and how to return the NSPopUpButtonCell for
that
column and row only.
I don't know what delegate method you would use, either. Forget
the delegate, you want a custom table column that inherits from
NSTableColumn. Load the .h into Interface Builder, then select
that column in your outline view. Now go to the custom class tab
and choose your new table column class.
Then, in your custom table column class override the
dataCellForRow: message to either call super or return your special
cell with the NSPopUpButtonCell. Of course, you'll have to create
that cell before you try to use it the first time. I create it in
my getter like this, so it is only created once and remembered
until dealloc:
- (NSImageCell *)cellImage
{
if (cellImage == nil)
cellImage = [[NSImageCell alloc] init];
return cellImage;
}
The way it works is the user selects a file and I read the file in
and
based on it's contents, I build the node tree in the outline view. I
tried at this point to add in an NSPopUpButtonCell, but the entire
column was button cells which I don't want.
Any help much appreciated.
Hope this helps.
john
Fight war, not wars.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40effigent.net
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