Re: delegate of an NWindowController's window
Re: delegate of an NWindowController's window
- Subject: Re: delegate of an NWindowController's window
- From: Conrad Shultz <email@hidden>
- Date: Thu, 29 Sep 2011 18:03:30 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 9/29/11 5:38 PM, Koen van der Drift wrote:
> This all goes fine, the sheet opens and I get generate the data,
> stored in an NSDictionary in MyDataWindowController. Now I want
> somehow to get the data back to MyAppDelegate. So I am trying this
> in MyDataWindowController:
...
> id <MyDataWindowControllerDelegate> del = [self delegate]; //
> <-------
>
> if ([del respondsToSelector:@selector(insertData:)]) { [del
> insertData: data]; } }
>
> [NSApp endSheet: [self window] returnCode: 1]; [[self window]
> orderOut: self];
>
> Which now gives the warning:
>
> Semantic Issue: Instance method '-delegate' not found (return type
> defaults to 'id') on the line with the arrow.
As Graham mentioned, NSWindowController does not have a -delegate
method. The compiler seems to be telling you that you didn't
implement one yourself either.
If I had to hazard a guess, I would surmise that you are getting
tripped up by the fact that NSWindow DOES respond to -delegate and, in
practice, one often sets an NSWindow's delegate to be an
NSWindowController instance.
So, you could declare a delegate property on MyDataWindowController
and handle it that way.
An alternate approach, depending on the details of your
implementation, might be to make use of some of the other parameters
in that lengthy -beginSheet... method; setting appropriate values for
didEndSelector (and, potentially, contextInfo if your design requires
it) can probably get you what you need.
- --
Conrad Shultz
Synthetiq Solutions
www.synthetiqsolutions.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iD8DBQFOhRViaOlrz5+0JdURAroXAJ4tO2WAshz1c/UpyoLnq6Q7s+VvkwCeLHiC
jPPm4IuWqlE5rnxhxmBZ7W0=
=6cVo
-----END PGP SIGNATURE-----
_______________________________________________
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