Re: NSCell and NSOutlineView question!
Re: NSCell and NSOutlineView question!
- Subject: Re: NSCell and NSOutlineView question!
- From: Gore <email@hidden>
- Date: Sat, 16 Mar 2002 02:29:47 +0200
I'm sorry, I don't want the checkbox and the textfiled in 2 different
tables, I want them in the same, that's the big problem! =(
as I've said I can display the checkbox and textfield but I can't edit
the checkbox...
On Saturday, March 16, 2002, at 02:13 , Joel Parker wrote:
For an example you can look at NSOutlineViewDragAndDrop. in the
developer examples directory. If you cannot edit it, make sure you are
switching on the column name (set as the identifier in IB). There are
to places to set and get these values, the snippets are below:
// This method is the set
- (id)outlineView:(NSOutlineView *)ov
objectValueForTableColumn:(NSTableColumn *)tableColumn
byItem:(id)item
{
NSString *identifier = [tableColumn identifier];
if ([identifier isEqual:@"itemCheckBox"]){
return [NSNumber numberWithBool:[item itemChecked]];
} else if ([identifier isEqual:@"itemText"]){
return [item itemName];
} else {
return [item itemName]; // Some Default Value
}
}
// This method is the get
- (void)outlineView:(NSOutlineView *)ov
setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn
byItem:(id)item
{
NSString *identifier = [tableColumn identifier];
if ([identifier isEqual:@"itemCheckBox"]){
[item setItemChecked: [object boolValue]];
} else if ([identifier isEqual:@"itemText"]){
[item setItemName:object];
} else {
[item setItemName:object]; // some default value
}
[outlineView reloadItem:rootNode reloadChildren:YES];
}
Hope that helps!
Joel Parker
On Friday, March 15, 2002, at 03:58 PM, Gore wrote:
I would like to create a cell that display a textfield and a checkbox
at the same cell. I have got it to display that by subclassing a
NSTextFieldCell and declared 1 NSButtonCell inside the
NSTextFieldCell, it is displayed orrectly and I can edit the text, but
I can't edit the state of the checkbox, am I doing this correctly or
have I missed something? help!!! =)
please give me an example or documentation on how to do this.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.