• 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: What should be the same object doesn't seem to be
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What should be the same object doesn't seem to be


  • Subject: Re: What should be the same object doesn't seem to be
  • From: Paul Bruneau <email@hidden>
  • Date: Tue, 2 Oct 2007 15:57:11 -0400

On Oct 2, 2007, at 11:48 AM, Fritz Anderson wrote:

The first question to ask is whether the inserted object is really not the same as the selected object. Your sample code shows you log the selected object, but not that you log the inserted object (just before or after setRepresentedObject:).

I greatly appreciate your response. In fact I have verified that the object is the same there. Some more digging has let me find where the objects differ and it was in a part that I didn't discuss very well if at all in my original post.


Where the (unfortunately) different OperationType objects are getting created is the part of the interface where I let the user select which OperationTypes a WorkCenter is (are) able to perform. I am using an IB window and bindings with a "master-detail" type of interface.

On the master (top) part of the window, is a table of the WorkCenters. Then when one is selected, the lower table is populated with an array containing the OperationTypes that the selected WorkCenter is able to perform.

I have a "New" button to add a new OperationType (to the list of operations the WorkCenter can perform), and I now think that is where my problem is. I have the New button's action set to "insert:"

After the new, blank operation type appears, I can click on it to bring up a popup (NSPopupButtonCell in the column) of the array of OperationTypes in order to select one from the list. The list is populated with Bindings and it all appears to work fine, but this is in fact where, instead of making the OperationType be one of the existing ones from the list, it seems to be duplicating it (as I can tell from it having a different pointer). The OperationType has the correct name, but I don't want it to be a duplicate, I want it to be the actual object.

The column is bound like this:
content = arrangedObjects.operationTypeName [OpnTypes (NSArrayController)]
contentValues = arrangedObjects.operationTypeName [OpnTypes (NSArrayController)]
selectedObject = arrangedObjects.operationTypeName [OpnTypes for Selection (NSArrayController)]


So I guess maybe my question is: is bindings appropriate to be able to put exact objects from one array into another? Or will it always make a copy of the object that it puts into the destination array?

The string representation of pointers is done through a format like "%x", which would suppress leading zeroes in the address. Your pointers don't look wrong to me.

thank you, that makes sense. So it is indeed the pointer to the object. _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >What should be the same object doesn't seem to be (From: Paul Bruneau <email@hidden>)
 >Re: What should be the same object doesn't seem to be (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Sorting one column table?
  • Next by Date: Re: Where are the boundaries of Cocoa and how are the boundaries perceived ?
  • Previous by thread: Re: What should be the same object doesn't seem to be
  • Next by thread: CoreData model optimization? (slow on insert with fetches)
  • Index(es):
    • Date
    • Thread