RE: CustomView outlet is always (null)
RE: CustomView outlet is always (null)
- Subject: RE: CustomView outlet is always (null)
- From: Oliver Donald <email@hidden>
- Date: Tue, 28 Oct 2003 09:57:26 -0000
Thanks Troy,
You where along the right lines - I had instantiated my RTIGScene object in
InterfaceBuilder, and that did have a connection to the CustomView. However,
I also instantiated an RTIGScene from my Controller object, and that was the
one I was using to send messages to the view. Off course, because I alloc'd
it myself it didn't come with a ready-made connection to the CustomView!
Thanks,
Oli
-----Original Message-----
From: Troy Stephens [
mailto:email@hidden]
Sent: 27 October 2003 22:29
To: Oliver Donald
Cc: email@hidden
Subject: Re: CustomView outlet is always (null)
On Oct 27, 2003, at 1:57 AM, Oliver Donald wrote:
>
...
>
So I put a new 'IBOutlet ID *sceneView' into my sceneDescription
>
object. I
>
loaded up InterfaceBuilder, made it read the new header for
>
sceneDescription, and the little exclamation mark appeared in it's
>
instantiation icon as expected. I subclassed NSView, called it
>
RTIGSceneView. I then put a CustomView in my window, set it's Class to
>
RTIGSceneView, and the change was reflected in the window. Then I
>
control
>
dragged from my destinationless sceneView object to the CustomView
>
(now a
>
RTIGSceneView) and connected my sceneView outlet to the RTIGSceneView,
>
and
>
the exclamation mark disappeared. Saved, compiled and ran. But the
>
CustomView never recieves any messages sent from sceneDescription, and
>
the
>
sceneView outlet is always '(null)'.
>
>
How do I give sceneDescription access to the CustomView?
What you're doing sounds correct in general.
How are you loading the window that contains the custom view? Is it
part of your application's main .nib file? Or are you writing an
NSDocument-based application, with your sceneDescription object as the
File's Owner (perhaps?) for a document .nib that the app loads when
opening the file?
All of your sceneDescription object's outlets should be set at the
point where it receives an -awakeFromNib message. If yours is a
document-based application, you should wait until your NSDocument
subclass (which I imagine might be your sceneDescription class)
receives -windowControllerDidLoadNib: before counting on its outlets
being set up.
>
I'm not sure about
>
terminology, but I'm guessing that sceneDescription is the data-source
>
for
>
CustomView and that I've got something backwards.
There's no specific terminology for connecting a controller or other
object to a view. NSTableView and NSOutlineView use the term
"dataSource" to denote a certain kind of functional relationship
between the view and a delegate object, but terminology aside it really
just boils down to an outlet that gives one object a pointer to
another... If your sceneDescription object has a need to message your
CustomView object, then providing a "sceneView" outlet in the
sceneDescription instance is appropriate. If you also need to be able
to message in the other direction, you may want an corresponding outlet
in the CustomView instance to make that connection as well.
Troy Stephens
Cocoa frameworks, Apple
DISCLAIMER: The information contained in this e-mail is confidential and may
be privileged. It is intended for the addressee only. If you are not the
intended recipient, please delete this e-mail immediately.
The contents of this email must not be disclosed or copied without the
sender's consent. We cannot accept any responsibility for viruses, so please
scan all attachments.
The statements and opinions expressed in this message are those of the
author and do not necessarily reflect those of the company. The company does
not take any responsibility for the views of the author.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.