• 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: Getting true parent window of views in drawers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting true parent window of views in drawers


  • Subject: Re: Getting true parent window of views in drawers
  • From: Mike Abdullah <email@hidden>
  • Date: Fri, 10 Mar 2006 00:24:17 +0000


On 9 Mar 2006, at 22:54, glenn andreas wrote:


On Mar 9, 2006, at 2:35 PM, Mike Abdullah wrote:

In my app I have an custom NSControl in my app. I want to register it to receive notifications from it's window. However, if the control is inside a drawer, it considers its window to be an instance of NSDrawerWindow.

This class is private, so there is no documentation. If I call parentWindow of it, I get NULL. However, I can call _parentWindow to get the true parent window of the control. Of course this is a private method, so seems a little dodgy to me.

Can anyone suggest either:

A. A better way of doing this?


Get a list of windows, and for each window call drawers to get a list of drawers associated with the window, and then see if your window is one of those drawers' window. May not be the quickest way, but shouldn't be too bad (even if you had a dozen windows with four drawers, that's only 48 things to check). And it's fully documented.

I have to say, this does seem a pretty decent way of doing things, particularly since it only needs to be done when registering for the notification in this particular case. However, I think I will file a bug report on it anyway, just to request the feature.


OR

B. How to stop the compiler warning me about calling _parentWindow?

I personally wish that all private methods of classes were listed with a pragma that caused a compiler error to prohibit you from using them at all. It's so easy and tempting to use undocumented methods that far too many people use them as it is...

Indeed, I do agree with you. I would just quite like to know how (or even if!) you can turn off the compiler warning for one particular method.


Glenn Andreas                      email@hidden
 <http://www.gandreas.com/> wicked fun!
Dominogy | Just place all the dominos on the board...


_______________________________________________ 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
  • Follow-Ups:
    • Re: Getting true parent window of views in drawers
      • From: Andy Lee <email@hidden>
References: 
 >Getting true parent window of views in drawers (From: Mike Abdullah <email@hidden>)
 >Re: Getting true parent window of views in drawers (From: glenn andreas <email@hidden>)

  • Prev by Date: Re: Getting true parent window of views in drawers
  • Next by Date: Re: Getting true parent window of views in drawers
  • Previous by thread: Re: Getting true parent window of views in drawers
  • Next by thread: Re: Getting true parent window of views in drawers
  • Index(es):
    • Date
    • Thread