Fixed that error now. I had a rogue arraycontroller in the NIB file from a previous predicate exercise. The nib is cleaned up and still no selection. It appears that I'm unable to get anything other than NULL from any objects instantiated in the NIB file. My appDelegate holds the code for the manageObjectContext and my method in my datasource to get that also just returns null. At the moment I'm puting this down to me not quite understanding Obj-C enough to communicate with out custom objects. Going to go read a book.

For completeness, here is my interface file. Do I have to declare NIB objects in order to use them like I've done below? I think this is where I'm falling down.

#import <Cocoa/Cocoa.h>
#import "moolahcoredata_AppDelegate.h"

@interface MLtableController : NSObject {
        NSOutlineView *MLoutlineView;
        NSTreeController *MLoutlineViewController;
        moolahcoredata_AppDelegate *MLappDelegate;
}

- (void) getSelectedAccount;

@end



On 22/05/2008, at 5:45 AM, Hamish Allan wrote:

I'd like to reiterate what Quincey noted:

"BTW, I notice that the "Cannot perform operation without a managed
object context" error is logged *before* you log "default". The
problem is not apparently anything to do with getting the selection in
the code you posted, since it happens before you do that."

You should try to find out what causes the "Cannot perform..." message
first and foremost -- perhaps by setting a breakpoint on NSLog()?

Hamish

On Wed, May 21, 2008 at 7:32 PM, Jonathan Dann <[EMAIL PROTECTED]> wrote:

- (void)getSelectedAccount{

      NSString *accountName = @"Bank";
      NSLog(accountName);
      accountName = [[MLoutlineViewController selection]
valueForKey:@"name"];
      NSLog(accountName);

      //get managedObjectContext in preparation for fetch code
      moc = [MLappDelegate managedObjectContext];

}

At first glance, try NSTreeController's -selectedObjects and - selectedNodes methods rather than -selection. Also, in my experience I've not found is necessary to bind the selectionIndexPath(s) to the outline view to get it
all to work, maybe unbind that as a quick test?

Jon
_______________________________________________

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/hamish%40gmail.com

This email sent to [EMAIL PROTECTED]


_______________________________________________

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