On Sep 16, 2008, at 7:17 PM, John Cebasek wrote:
Well, I did use [self selectedRow], in a previous version of the code. but that also returned -1. I don't think I'm doing anything 'weird', the view has a delegate and a datasource which are in the same class connected in the xib. The awakeFroNib message populates the list. There are currently two parents (expandable) and a bunch of children in each. Things are populated corrected. My selection change notification is firing, so why wouldn't that cause _lastRowSelected (in the NSTableView member of the NSOutlineView, which I am assuming (and we all know what assume means) is the member that contains the currently selected row) be changed to reflect the currently selected row.

To make sure I understand: you have a subclass of NSOutlineView? And you have an instance of that subclass? And you have code in that subclass that calls [self selectedRow]?

*When* are you making this call to [self selectedRow]? Is there any chance you're calling it too soon, before the outline view has updated its internal state?

Why do you think it's returning -1? Are you printing it with NSLog()? Are you examining it in the debugger?

How *many* instances of your subclass do you have? Are you sure you have just one? Sometimes people make the mistake of creating an instance in their UI window and thinking they have to create another instance in the nib window. All you have to do is drag an NSOutlineView from the IB palette into your UI window, and use the inspector to change its class to your class. Or sometimes people accidentally create two instances in the UI window, and one covers the other so they never notice. If you add this line to -awakeFromNib and again just before you call [self selectedRow], does the same address always get printed out?

    NSLog(@"address of my outline view: 0x%X", self);

How about if you add this to your notification handler -- does the same address still get printed?

NSLog(@"%@ notification from 0x%X", [notification name], [notification object]);

--Andy

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to