Re: NStoolbarItem, custom view, setAction:
Re: NStoolbarItem, custom view, setAction:
- Subject: Re: NStoolbarItem, custom view, setAction:
- From: Peter Ammon <email@hidden>
- Date: Mon, 9 Aug 2010 17:51:01 -0700
On Aug 9, 2010, at 5:37 PM, Tony Romano wrote:
[...]
>
>
> Looking at the documentation for NSToolbarItem setAction:, it has a little note: "For a custom view item, this method calls setAction: on the view if it responds.". Which I infer to mean, that the basic Custom View should work. What really interesting is NSToolbarItem is derived from NSObject(which is a whole other discussion on this design), so the setAction and setTarget need to get stored somewhere, there are no apparent private variables to store these items. Looking at the toolbar item in the debugger, the object knows that the view doesn't support set/get action because they set some bits on creation and look at the bit setting instead of calling respondsToSelector every time.
>
> Anyone have any ideas as to why I can't use a custom view derived from NSView?
You can set any custom view you want. However, NSToolbarItem delegates its target/action entirely to its view, and has no storage for these properties. If your view does not implement -target or -action, then the toolbar item's target and action will both be NULL.
Hope this helps,
-Peter
_______________________________________________
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