• 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
Selection in NSTableView during windowControllerDidLoadNib w/ CoreData+bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Selection in NSTableView during windowControllerDidLoadNib w/ CoreData+bindings


  • Subject: Selection in NSTableView during windowControllerDidLoadNib w/ CoreData+bindings
  • From: email@hidden
  • Date: Fri, 17 Feb 2006 00:46:56 -0500

Hello,

I seem to be having a world of problems accomplishing the following task, although I have found an ugly workaround: I have a little app that contains an NSTableView (bound to an NSArrayController) and I track the user's selection in that view. I save the selection to the managed object context whenever a save occurs and would like to restore that selection when the document (in my document based app) loads, so in windowControllerDidLoadNib, I look it up and use the setSelectedObjects: method to restore the selection in the NSTableView. NSLog statements confirm that the proper identifiers are being saved to the moc and are loaded back out of the moc, and a log statement in tableViewSelectionDidChange: also reveals that the correct item in the table view is indeed selected...Well, not really. You see, the selection doesn't actually occur in the view (and there for while, when I had "avoid empty selection" checked, it even arbitrarily selected an item in the table.)

Ok, so I can understand that CoreData is going to do lazy loading, which means that I probably can't expect anything to be guaranteed about my table in windowControllerDidLoadNib, which also explains my problems getting a selection, and I've sort of learned my lesson. However, what I've tried that does work is adding a little timer in windowControllerDidLoadNib that delays a second, and then makes the selection.

This workaround does work like a charm, but just seems so ugly. Is there a better way someone could point me to? Or is this particular problem a limitation of CoreData that I should file an enhancement request about?

M.
 _______________________________________________
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: Selection in NSTableView during windowControllerDidLoadNib w/ CoreData+bindings
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Change build flags; Ignore warnings; Alter C code?
  • Next by Date: How to load a special nib file in cocoa?
  • Previous by thread: Re: Change build flags; Ignore warnings; Alter C code?
  • Next by thread: Re: Selection in NSTableView during windowControllerDidLoadNib w/ CoreData+bindings
  • Index(es):
    • Date
    • Thread