• 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
Re: NSComboBox Coredata bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSComboBox Coredata bindings


  • Subject: Re: NSComboBox Coredata bindings
  • From: Wain <email@hidden>
  • Date: Thu, 1 Dec 2005 18:50:20 +0000

Hi,

I'm afraid you will have to write your own code to do this as there is no simple bindings solution.

I haven't tried this but it shouldn't be too difficult...
In your combo box target you simply need to check whether the text is the name of a Category or not,
if it is, set the Category to the Transaction relationship,
if it isn't, create a new Category and set that to the Transaction relationship.

You might need to partially implement a combo box delegate aswell to get it to work as you want...

Wain


On 1 Dec 2005, at 15:27, Julien Bordet wrote:

Hi,

Thanks for your help.

Note that you said you set 'Automatically prepares content' earlier,
basically that means that the
controller will keep an eye on your managed object context and update
itself automatically.
So it sees the new categories as soon as you add them.

OK. Didn't know that.

From what you have said so far I think your data model looks like this:

< Transaction >
< category > <<------------> < Category >
< category >

where Transaction.category is a relationship
and Category.category is a string (the category name...)

Yes, you understood my model very well.

I'm surprised that you can select a category from the combo box as
this will attempt
to set the string value of the Category's category attribute to the
category relationship
of the Transaction, which expects a Category (NSManagedObject).
So, I'd expect a validation error whenever you try to do it.


In fact, you are right. What is correct is the fact that the NSComboBox correctly prints the categories. But, as you expected, when I select one, I got the error message I reported in my first message.

So, from the start, the problem is not limited to adding new category, but to category values in the Transaction object.

I use Xcode 2.1.

If your bindings for the combo box were:

content : CategoryArrayController.arrangedObjects

contentValues : CategoryArrayController.arrangedObjects.category

value : TransactionArrayController.selection.category.category
(note the additional .category)

Then you would be able to select the combo box entry as you are
trying to set a string
to a string, but the value won't be stored as the Transaction still
hasn't got a Category
to store.

I've tried what you said above. It still does not work. When I select a category, I get a "An Error occurred" window (exact message in French) and a new message,

2005-11-28 11:44: 10.198 iMoney[13616] *** -[NSSelectionBinder _didPresentModalAlert:contextInfo:] selector not recognized [self = 0x4d070f0]


I'm sure I want to use a NSComboBox, as I want the user to be able to dynamically add categories.

Any idea ? I'd be very happy if we can get it to work, as it seems there is no example code on the internet about that...

Many thanks

Julien




___________________________________________________________ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.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
  • Follow-Ups:
    • Re: NSComboBox Coredata bindings
      • From: Julien Bordet <email@hidden>
References: 
 >Re: NSComboBox Coredata bindings (From: Julien Bordet <email@hidden>)

  • Prev by Date: Re: Find all running apps and their windows
  • Next by Date: Re: Help on subclassing
  • Previous by thread: Re: NSComboBox Coredata bindings
  • Next by thread: Re: NSComboBox Coredata bindings
  • Index(es):
    • Date
    • Thread