• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Bound object of NSPopUpButton always the same
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bound object of NSPopUpButton always the same


  • Subject: Bound object of NSPopUpButton always the same
  • From: Stefan <email@hidden>
  • Date: Mon, 31 Jul 2006 22:00:56 +0200

Using two NSArrayControllers (myFromAccountArrayController, myToAccountArrayController )
who manage the same entities, I created two NSPopUpButton to select a from and
a to property.


Then I create two new other entities (transactionTo, transactionFrom) and try to relate
them (@"transaction2Account") to the previously using NSPopUpButton selected entities.


The app compiles and runs fine, I get two new entities, but both relate to the same
entity - which is not related to the NSPopUpButton selected entity. The related entity
seems to be the first available, not the one selected.


The NSPopUpButtons bind content and contentValues. selectedObject is not bound,
since I have no 'target' entity to save the selected stuff.


Why are my newly created entities not related to my NSPopUpButton selected entities?

>>>
NSManagedObject *fromAccountMO;
NSManagedObject *toAccountMO;

NSManagedObjectContext *context = [myPersistentDocument managedObjectContext];

// get selected entities from NSPopUpButton bound controllers
fromAccountMO = [[myFromAccountArrayController selectedObjects] objectAtIndex:0];
toAccountMO = [[myToAccountArrayController selectedObjects] objectAtIndex:0];


// Create new entity
NSManagedObject *transactionTo = [NSEntityDescription
insertNewObjectForEntityForName:@"TAMTransaction" inManagedObjectContext:context];


	// Relate it to the NSPopUpButton selected properties.
	[transactionTo setValue:fromAccountMO forKey:@"transaction2Account"];
<<<

_______________________________________________
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


  • Follow-Ups:
    • Re: Bound object of NSPopUpButton always the same
      • From: Stefan <email@hidden>
  • Prev by Date: Re: Keeping an App Alive
  • Next by Date: Re: NSTabView and edit fields
  • Previous by thread: Re: Obtaining environment variables from a cross-referenced project
  • Next by thread: Re: Bound object of NSPopUpButton always the same
  • Index(es):
    • Date
    • Thread