Re: NSComboBox Coredata bindings
Re: NSComboBox Coredata bindings
- Subject: Re: NSComboBox Coredata bindings
- From: Wain <email@hidden>
- Date: Thu, 1 Dec 2005 22:02:57 +0000
You want to do this stuff in a standard target-action method to be
called by the combo box,
call it categorySelection for example:
- (IBOutlet)categorySelection:(id)sender
{
get text from combo box
search for a matching Category
if(Category found)
{
join the Category to the Transaction...
}
else
{
NSManagedObject *type = [NSEntityDescription
insertNewObjectForEntityForName:@"Category"
inManagedObjectContext:managedObjectContext];
set the Category name
join the new Category to the Transaction...
}
}
You probably want to do this in your document class...
You can't automatically set this creation up with bindings, the best
you can do
is to have the combo populated with data, and have the combo selection
set whenever you change the current selection of Transaction.
You will have to manually
Your bindings should continue to look something like:
content : CategoryArrayController.arrangedObjects
contentValues : CategoryArrayController.arrangedObjects.category
value : TransactionArrayController.selection.category.category
so that the combo's value will be set by the string taken from the
name of the Category
to which the Transaction is connected.
Hope this makes sense :-)
Wain
On 1 Dec 2005, at 21:15, Julien Bordet wrote:
Hi
OK. One last thing : what is the function called when I create a
new category ?
For example, I'd changed the Category Entity, with new methods :
- (NSString *)myCategory;
- (void)setMyCategory:(NSString *)new
Then I bound the NSCombobox to
value = TransactionArrayController.selection.myCategory
When I created a new transaction, myCategory: is called, but when I
added a new one through the combobox, setMyCategory is never called (I
traced with NSLog).
In which method can I make the changes ?
Many thanks
Julien
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.
http://uk.security.yahoo.com
_______________________________________________
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