• 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: Odd Toolbar Behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Odd Toolbar Behavior


  • Subject: Re: Odd Toolbar Behavior
  • From: j o a r <email@hidden>
  • Date: Tue, 15 Jan 2002 22:46:15 +0100

A view can only have one superview - read the documentation for NSView.
The toolbar does not know how to copy your custom view item (it could possibly be very complex, and certainly not always comply with the NSCopying protocol), and doesn't attempt to, but it does know how to copy a NSMenu / NSMenuItem and so uses a different menu for the PopUpButton and the menu used in text only mode.
Since the toolbar doesn't copy your custom view you end up with the same view in several toolbar items (the PopUpButton), and this is the root of your problems.
The solution is simply that you need to take responsibility for making an unique copy of each toolbar item needed for each toolbar - and each multiple occurance within one toolbar - as per the documentation for NSToolbar. If you wan't to desing your custom views in Interface Builder, then simply load the nib multiple times, once for each toolbar item you need.

j o a r


On Tuesday, January 15, 2002, at 06:03 , Jeff Disher wrote:

Hello,

I am using a Toolbar in a doc-based app I am writing
and having some odd behavior with one of the view
elements. Since this program needs to modify this
view item (NSPopupButton), I decided to hold the view
in the MainMenu.nib file and access it from within
the document instances with [NSDocumentController
sharedDocumentController] (the NSDocumentController
has outlets to these elements) when creating the new
toolbar instance for each document.

Now for the odd part. Everything is working perfectly
(even modifications of the popup) except that the view
can only exist on one toolbar at a time. Whenever I
open a new window, the view on the previous window's
toolbar becomes blank. I would have thought that
using the shared controller instance to access these
(read "cheat the system") elements would have caused
the problem but the menu that cooresponds to the view
(used when in text-only mode) works perfectly in
several windows at once.

I can't understand why the view holding the
NSPopupButton would be any different.

Can anyone shed some light on this one for me?

Thanks,
Jeff.
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
_______________________________________________
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.


References: 
 >Odd Toolbar Behavior (From: Jeff Disher <email@hidden>)

  • Prev by Date: Re: Getting list of classes
  • Next by Date: Re: multithreaded PDF Rendering
  • Previous by thread: Odd Toolbar Behavior
  • Next by thread: Re: Dock icon position
  • Index(es):
    • Date
    • Thread