That's the conclusion I came to but wanted to make sure I didn't miss something 
obvious.  The documentation is omitted this detail.  I'll file a bug for this.  

For the life of me, I cannot understand why NSToolbarItem contains the view and 
is not derived from a view, it just adds more work on the developer to do 
custom work.  I wanted to do some work and need to track the mouse messages.  
It would have been much simpler if it was derived from the view and I could 
over-ride the methods.

Thanks for confirming this Peter,
-Tony

On Aug 9, 2010, at 5:51 PM, Peter Ammon wrote:

> 
> 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
> 

-Tony

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to