Skip navigation.
 
mlRe: Programmatically get treecontroller selection
FROM : Steven Hamilton
DATE : Wed May 21 23:00:35 2008

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 <j.p.<email_removed>> 
> 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 (<email_removed>)
>>
>> 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/<email_removed>
>>
>> This email sent to <email_removed>
>>

Related mailsAuthorDate
mlProgrammatically get treecontroller selection Steven Hamilton May 19, 14:29
mlRe: Programmatically get treecontroller selection Jonathan Dann May 19, 21:18
mlRe: Programmatically get treecontroller selection Hamish Allan May 19, 22:12
mlRe: Programmatically get treecontroller selection Steven Hamilton May 20, 12:10
mlRe: Programmatically get treecontroller selection Quincey Morris May 20, 19:18
mlRe: Programmatically get treecontroller selection Jonathan Dann May 20, 19:55
mlRe: Programmatically get treecontroller selection Jonathan Dann May 20, 20:01
mlRe: Programmatically get treecontroller selection Steven Hamilton May 21, 11:53
mlRe: Programmatically get treecontroller selection Jonathan Dann May 21, 20:32
mlRe: Programmatically get treecontroller selection Hamish Allan May 21, 21:45
mlRe: Programmatically get treecontroller selection Steven Hamilton May 21, 23:00
mlRe: Programmatically get treecontroller selection Steven Hamilton May 22, 11:11