• 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: Bindings Sample code / Suggested reading
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings Sample code / Suggested reading


  • Subject: Re: Bindings Sample code / Suggested reading
  • From: Glen Simmons <email@hidden>
  • Date: Fri, 5 Aug 2005 09:30:05 -0500


On Aug 3, 2005, at 8:58 PM, Brian Smith wrote:

Try looking at the graphics example from ( and some of the other examples ),
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html

I looked at this and didn't quite understand what it was doing. It appears that it binds the array controller's selectionIndexes to the GraphicView, but the GraphicView turns around and uses the array controller as its selectionIndexesContainer. I don't get it.


Like this example, I expose the selection indexes and the controller for them in the view. My inspector panel's window controller then observes NSWindowDidBecomeMainNotification and once the main window changes programally switches the bindings of the inspector to the new main window view's selection controller. I'm not sure if this is a better way to do this but it works. Doesn't the NSTreeController for the document class handle selections, not the document class? This sounds odd that you bind to your document class for this.

Well, the document knows when the selection changes because it's happening in the document's window. How would the NSTreeController "handle selections" unless it finds out about them from the document?


Brian

On Aug 4, 2005, at 1:00 AM, Glen Simmons wrote:


I'm having an issue with NSTreeController's selectionIndexPaths binding. I'm trying to bind controls in an inspector panel to the current document's selection. I've bound the NSTreeController's contentObject to Shared Application.mainWindow.windowController.document.rootObject and the selectionIndexPaths to Shared Application.mainWindow.windowController.document.selectionIndexPaths. My document class has the correct accessors and when the selection changes, I call setSelectionIndexPaths in my document and the bindings update and everything is great. That is, until the document loses focus or I switch documents. Then my document's setSelectionIndexPaths method gets called by the binding system with an empty array, so the selection is wrong. Why is it doing that and how do I make it stop?

Thanks,
Glen

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40suaveware.com


This email sent to email@hidden






_______________________________________________ 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
References: 
 >Bindings Sample code / Suggested reading (From: Glen Simmons <email@hidden>)
 >Re: Bindings Sample code / Suggested reading (From: Brian Smith <email@hidden>)

  • Prev by Date: Re: Basic instinct (not entirely OT yet...)
  • Next by Date: Re: ComboBox Questions
  • Previous by thread: Re: Bindings Sample code / Suggested reading
  • Next by thread: RESEND: NSMetadataItem performance issues
  • Index(es):
    • Date
    • Thread