• 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: Easier way to call NSBrowser's delegate from browser matrix?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Easier way to call NSBrowser's delegate from browser matrix?


  • Subject: Re: Easier way to call NSBrowser's delegate from browser matrix?
  • From: Jeremy Dronfield <email@hidden>
  • Date: Sun, 5 Dec 2004 19:28:58 +0000

That's much more sensible. I'll do that. Thanks.

Regards,
Jeremy


On 5 Dec 2004, at 5:26 pm, Nick Zitzmann wrote:


On Dec 5, 2004, at 5:14 AM, Jeremy Dronfield wrote:

- (id)browserDelegate
{
return [(NSBrowser *)[[[[[[self superview] superview] superview] superview] superview] superview] delegate];
}


which seems somewhat ludicrous. There must be a smarter way?

Yes. What I usually do is add a category to NSView that returns the first superview that is of a certain class, like this: (warning - written in Mail, untested, you know the rest)


- (id)firstSuperviewOfClass:(Class)aClass
{
	id aSuperview = [self superview];

	while (aSuperview != nil)
	{
		if ([aSuperview isMemberOfClass:aClass])
		{
			break;
		}
		aSuperview = [aSuperview superview];
	}
	return aSuperview;
}

Then you can pass in the browser's class and message the browser that way...

Nick Zitzmann
<http://www.chronosnet.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
References: 
 >Easier way to call NSBrowser's delegate from browser matrix? (From: Jeremy Dronfield <email@hidden>)
 >Re: Easier way to call NSBrowser's delegate from browser matrix? (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Best way to debug (was retain/release/pointers question)
  • Next by Date: Re: Best way to put two NSCells in one?
  • Previous by thread: Re: Easier way to call NSBrowser's delegate from browser matrix?
  • Next by thread: Key value observing?
  • Index(es):
    • Date
    • Thread