Re: How to set the string and integer value of an NSButtonCell using NSOutilneView

2009-07-27 Thread Graham Cox


On 28/07/2009, at 7:17 AM, Korei Klein wrote:

Also, how do I determine the index of the column which is the second  
argument of outlineView:objectValueForTableColumn:byItem.



[[theOutlineView tableColumns] indexOfObject:theTableColumn];

You need to be wary of using the index though - it isn't fixed as the  
user can drag columns, so it's better whenever possible to use the  
table column object itself. It should have anything you want to know  
about the column.


--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to set the string and integer value of an NSButtonCell using NSOutilneView

2009-07-27 Thread Chase Meadors
Well, according to the documentation, an NSButtonCell's object value  
(and all interpretations thereof) correspond to the state of the  
button (on, off, or mixed). You want to set this as well as set the  
title of the button. Unlike NSBrowser, NSOutlineView's data source  
methods don't provide direct access to the cell, it only asks you for  
the object value.


It's a bit of a pain, but if you want the button state AND the title  
of the button to be affected by object value, you could subclass  
NSButtonCell and override -setObjectValue:. THEN, in the datasource  
methods, you could pass a dictionary containing an int and a string.  
Then do this:


- (void)setObjectValue:(id)object {

[super setObjectValue:[object valueForKey:@"buttonState"]];

[self setTitle:[object valueForKey:@"buttonTitle"]];

}

Getting controls to USE your custom cell can be icky (NSBrowser ack!),  
but I don't have much experience with NSOutlineView. If you have  
trouble with that, just reply and ask on the list. You should be able  
to just call -setCellClass:[MyCustomCell class] on your outline view.


On Jul 27, 2009, at 4:17 PM, Korei Klein wrote:

I'm implementing an NSOutlineViewDataSource object which will be the  
data source of an NSOutlineView.

The NSOutlineView displays its data in NSButtonCell s.

The value displayed in an NSButtonCell is both an integer, and a  
string.
The delegate method which I am implementing  
outlineView:objectValueForTableColumn:byItem, however, allows me to  
return only one value to the NSOutlineView.


Is it possible for my implementation of  
outlineView:objectValueForTableColumn:byItem to set both the string  
value and the integer value of the NSButtonCell?



Also, how do I determine the index of the column which is the second  
argument of outlineView:objectValueForTableColumn:byItem.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/c.ed.mead%40gmail.com

This email sent to c.ed.m...@gmail.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


How to set the string and integer value of an NSButtonCell using NSOutilneView

2009-07-27 Thread Korei Klein
I'm implementing an NSOutlineViewDataSource object which will be the 
data source of an NSOutlineView.

The NSOutlineView displays its data in NSButtonCell s.

The value displayed in an NSButtonCell is both an integer, and a string.
The delegate method which I am implementing 
outlineView:objectValueForTableColumn:byItem, however, allows me to 
return only one value to the NSOutlineView.


Is it possible for my implementation of 
outlineView:objectValueForTableColumn:byItem to set both the string 
value and the integer value of the NSButtonCell?



Also, how do I determine the index of the column which is the second 
argument of outlineView:objectValueForTableColumn:byItem.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com