• 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: Toolbar code in separate Controller?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Toolbar code in separate Controller?


  • Subject: Re: Toolbar code in separate Controller?
  • From: Graham Cox <email@hidden>
  • Date: Tue, 8 Jul 2008 01:52:22 +1000


On 8 Jul 2008, at 12:13 am, John Love wrote:

Initially, my ToolbarController was sub to NSObject as was the case for
Apple's SimpleToolbar, so I changed the super class of my ToolbarController
to NSControl.

Huh? This makes no sense whatsoever. Why not just make your toolbar's delegate/controller the document and save yourself a whole heap o' hassle? That's what I expect most people do and it's the easiest solution. After all, the document is the controller that pulls together all the different bits of UI that your app uses per document, such as toolbars, windows, etc. It's the logical place. Sometimes making a separate controller makes sense (like for a dialog box), sometimes making some existing object do that job makes sense - typically a document subclass does end up acting as a bit of a jack of all trades in terms of handling various odd bits of different functionality (but all related to the document, naturally).


If you really want to do it the hard way, you could maybe subclass NSResponder (but definitely NOT NSControl). Even so, no responder is put automatically into the responder chain unless it's a view (or view's "owner") that the user explicitly makes key in some way. However, your document is in the responder chain by design - another good reason to use it to handle your toolbar. However, making a controller a view subclass just to obtain the ability to make it key is simply wrong and will never work.


I read somewhere that NSView calls [self setRefusesFirstResponder:FALSE]


Only NSControl and NSCell implement this method, as typing it into the documentation window's search box will show in a second. So you're barking up the wrong tree here.

hth,

Graham
_______________________________________________

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


  • Follow-Ups:
    • Re: Toolbar code in separate Controller?
      • From: "John Love" <email@hidden>
References: 
 >Toolbar code in separate Controller? (From: "John Love" <email@hidden>)
 >Re: Toolbar code in separate Controller? (From: Uli Kusterer <email@hidden>)
 >Re: Toolbar code in separate Controller? (From: "John Love" <email@hidden>)

  • Prev by Date: Re: Efficiently receiving data from an NSTask
  • Next by Date: Re: NSURLConnection how to handle 502 error
  • Previous by thread: Re: Toolbar code in separate Controller?
  • Next by thread: Re: Toolbar code in separate Controller?
  • Index(es):
    • Date
    • Thread