views:

100

answers:

1

Hi, i'm trying to program a drawer function into Smultron (an open source code editor) but i'm having a bit of trouble with it. I keep on getting an error that says:

2009-09-20 12:43:06.067 Smultron[4481:a0f] -[SMLProject directoryDrawer]: unrecognized selector sent to instance 0x2003ea6c0

Now in SMLProject on interface builder I connected an NSDrawer thingy up to the mainwindow in their and added this to SMLProject.h:

@property (readonly,retain) IBOutlet NSDrawer *directoryDrawer;
@property (readonly) IBOutlet NSOutlineView *directoryDrawerList;

and this to SMLProject.m (that get's called when opening a directory via another method in SMLCurrentProject)

- (void)openDirectoryDrawer:(NSString *)directory
{
    // todo: set directory contents
    [[self directoryDrawer] setParentWindow:[self window]];
    [[self directoryDrawer] open];
}
+2  A: 

Did you synthesize the properties in SMLProject.m?

@synthesize directoryDrawer, directoryDrawerList;

Additionally, why is directoryDrawer set as readonly, and the retain property? Retain does not make sense at all, since the property is readonly.

JoostK
Nope, i will try that now :D
kennyisaheadbanger
I get "error: synthesized property 'directoryDrawer' must either be named the same as a compatible ivar or must explicitly name an ivar" now when building and also one for directoryDrawerList
kennyisaheadbanger
i added the definitions to the @interface part and it worked :D oh, and removed the retain property.THNX VERY MUCH :D
kennyisaheadbanger
Then you really have to look at the Apple Documentation on properties (http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocProperties.html). They are new in Obj-C 2.0 and you use them to create setter/getter methods, so they must correspondent with an instance variable.
JoostK
oh, i'm just trying to learn cocoa and objective-c so i can make a php app without a trail app running out to edit it in (got no money)
kennyisaheadbanger