Re: Bindings - accessing the model from a seperate window
Re: Bindings - accessing the model from a seperate window
- Subject: Re: Bindings - accessing the model from a seperate window
- From: Dan Price <email@hidden>
- Date: Mon, 16 Jan 2006 18:37:33 +0000 (GMT)
Hi again - I figured out what I was doing wrong at the
weekend. I mentioned before that my external palettes
grabbed a reference to the model (my Document
subclass) from the app delegate, which in turn
obtained this reference by asking for the current main
window (which would have to be the frontmost document
window, if any). This was a kludge.
Now, each palette has a pointer to the document. When
the app broadcasts a notification relevent to the
document window (ie. resigned, changed, closed etc)
the pallete's WindowController hears it, and assigns
the Notification object passed to this variable, which
I call SceneDoc. The object passed back by the
notification is the window in question, and the
delegate is the model. This works great in code.
So I've setup a ControllerObject in the palette nibs
(of class SceneDoc), pointing at the
ShareApplications' mainwindow delegate with a
keystring. This object, I call SceneDocAlias. A second
controller, SelectedShapeAlias (class Shape), points
at SceneDocAlias and adds a keystring to obtain the
currently-selected object, if any. My
selection-specific controls can then be bound to these
controllers.
Thanks Volker for sending me your example code! Alas,
the binding mechanism is obscured by all of the Core
Data stuff. Really makes my code look old fashioned!
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.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