• 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: Problem with custom control in NSToolbar
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with custom control in NSToolbar


  • Subject: Re: Problem with custom control in NSToolbar
  • From: Chris Giordano <email@hidden>
  • Date: Tue, 8 Jun 2004 10:09:05 -0400

Laurent,

I haven't seen a response from one of the more knowledgeable members of the list yet, so...

On Jun 7, 2004, at 4:54 PM, Laurent Daudelin wrote:

Hi all!

I have a problem which had me pulling my hairs for the last couple of days.
I finally decided to ask here for help before I no longer have hairs to pull
out!

Basically, I took the "ImagePopUpButton" class from
<http://iratescotsman.com/products/source/> to use it in a toolbar. This is
a subclass of NSPopUpButton that reproduces the behavior of popup toolbar
items in Xcode, for example.

After making some additions to the code (NSCoding protocol since NSToolbar
seems to encode some items at some point), the popup button works fine.
However, when I choose to customize the toolbar, the icon doesn't show up in
the customization palette. Only the title. If I remove the current item from
the toolbar, then drag the one from the palette, it will appear immediately.
I've checked everything I could think of, be it the min size of the toolbar
item and its max size, the cellframe where the custom cell is displaying
those icons, I can't for the life of me finding what is missing.

Anybody has any idea or ran into a similar issue? Code is available upon
request to <mailto:email@hidden>.


How are you returning the toolbar item in toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:? There was some discussion a month or so back (see the thread "Subclassing NSToolbar is *almost* really good") in which the same kind of issue was happening. The fix there was to be sure to return a copy (i.e., [toolbarItem copy]) of the toolbar item in this method. Even creating a new toolbar item and setting the view to be identical to the source doesn't entirely work -- it has similar odd results (in the test code I'm looking at, it usually disappears from the toolbar when the customization palette is displayed). My guess is that creating a copy of the view would work, but I'm not really in a position to test that out right now.

Hope this helps.

chris
_______________________________________________
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.


  • Follow-Ups:
    • Re: Problem with custom control in NSToolbar
      • From: Laurent Daudelin <email@hidden>
References: 
 >Problem with custom control in NSToolbar (From: Laurent Daudelin <email@hidden>)

  • Prev by Date: Re: How to quit
  • Next by Date: Re: How to quit
  • Previous by thread: Problem with custom control in NSToolbar
  • Next by thread: Re: Problem with custom control in NSToolbar
  • Index(es):
    • Date
    • Thread