Problems applescripting Core Data subclass
Problems applescripting Core Data subclass
- Subject: Problems applescripting Core Data subclass
- From: Elise van Looij <email@hidden>
- Date: Fri, 3 Nov 2006 17:24:03 +0100
Greetings to all. I'm quite ignorant of cocoa programming but have a
fair amount of experience in applescript and Applescript Studio. A
few weeks ago I discovered Core Data modeling and have been happily
binding ever since and looking forward to the day I can finally kick
Filemaker out altogether.
I've been working on a little app to help me keep trach of my
projects and decided that what I really wanted was not just typing in
the path to a particular folder but get the Finder to help me choose
the folder and then store that path in myApp and do cool stuff with it.
I soon found out that for that I needed to subclass my entity
Projecten (the app speaks Dutch, as do I) and that ProjectBuilder
very gallantly writes all the code if one selects the data model and
chooses File >> New File > Managed Object Clas s. So now I have
Projecten.h and Projecten.m with all the setters and getters.
I put a button on my interface and connected the onClick to my file
Projecten_controller.applescript. Next I connected
Projecten_ArrayController's Awake from Nib event also to
Projecten_controller.applescript where I store the reference in a
property also named Projecten_ArrayController. All I needed to do
now, I thought was on the onClick to get the path to the folder, set
the FolderPath attribute and Bob's your uncle, but unfortunately it
doesn't work that way. I don't get any errors, but my folderPath
doesn't get set or stored either. Any help would be greatly
appreciated. The relevant code follows below:
Elise van Looij
Projecten.m ---I didn't write this, Xcode did so it should be
good-------------------------
#import "Projecten.h"
@implementation Projecten
- (NSString *)projectFolder
{
NSString * tmpValue;
[self willAccessValueForKey: @"projectFolder"];
tmpValue = [self primitiveValueForKey: @"projectFolder"];
[self didAccessValueForKey: @"projectFolder"];
return tmpValue;
}
- (void)setProjectFolder:(NSString *)value
{
[self willChangeValueForKey: @"projectFolder"];
[self setPrimitiveValue: value forKey: @"projectFolder"];
[self didChangeValueForKey: @"projectFolder"];
}
@end
------------------------------------------------------------------------
-----------------
Projecten_controller.applescript----------------------------------------
-----
property Projecten_ArrayController : missing value
on awake from nib theObject
setProjecten_ArrayController given Projecten_ArrayController:theObject
log (call method "entityName" of Projecten_ArrayController) --logs
"Projecten"
end awake from nib
on setProjecten_ArrayController given
Projecten_ArrayController:objProjecten_ArrayController
set Projecten_ArrayController to objProjecten_ArrayController
end setProjecten_ArrayController
on addProjectFolder()
-- this method is called by the view script which uses the
return value to update the interface
local strDocumentPath
set strDocumentPath to choose folder without invisibles
call method "setProjectFolder:" of Projecten_ArrayController with
parameter strDocumentPath
log (call method "projectFolder" of Projecten_ArrayController) --
logs absolutely nothing. No error either.
return strDocumentPath
end addProjectFolder
---------------------------------------------------------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden