Re: dangers in having a view in a toolbaritem
Re: dangers in having a view in a toolbaritem
- Subject: Re: dangers in having a view in a toolbaritem
- From: j o a r <email@hidden>
- Date: Thu, 7 Aug 2003 08:20:40 +0200
On Thursday, August 7, 2003, at 07.40, Francisco Tolmasky wrote:
Ok, we all know that an nsview can't be two places at once. That much
said, does this apply to toolbaritem's as well? When you place a view
inside a toolbaritem, that same view appears again when you customize
the toolbar. I guess this is just a curiosity question, but does no
problem arise from this?
Not if you take into account the requrements placed on the view
provided. From the documentation of the "setView:" method of
NSToolbarItem:
========================================================================
=====
[...] Also, everything recursively contained in view must be archivable
if the customization palette is used. For a view item to be archivable,
it and all of its contents must conform to the NSCoding protocol. This
implementation is not an issue for standard framework components, but
you must be careful with subclasses of them.
========================================================================
=====
In other words: They can rely on the fact that they can make copies of
the views provided when necessary. They also mention the copy in the
docs of the delegate method
"toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: ":
========================================================================
=====
[...] Do not assume that the returned item is going to be added as an
active item in the toolbar, as it could be that it will be used only in
the customization palette. (The customization palette makes a copy of
the returned item.)
========================================================================
=====
j o a r
_______________________________________________
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.