NSToolbarItem target action and view
NSToolbarItem target action and view
- Subject: NSToolbarItem target action and view
- From: Torsten Curdt <email@hidden>
- Date: Thu, 22 Sep 2011 02:04:42 +0200
Just like Xcode's scheme management I have some display in the toolbar
and would like to popup a menu on click. So I create a NSToolbarItem
and set a custom view. But now the view also receives the clicks and
so the action set on the item is not getting triggered on a click.
NSToolbarItem *toolbarItem = [[NSToolbarItem alloc]
initWithItemIdentifier:itemIdentifier];
[toolbarItem setLabel:name];
[toolbarItem setPaletteLabel:name];
[toolbarItem setToolTip:name];
[toolbarItem setTag:tag];
[toolbarItem setView:view];
[toolbarItem setTarget:target];
[toolbarItem setAction:selector];
Not really that unexpected. But how could change that?
I could add target/action execution to the view.
I could also wrap the view in a NSButton.
All no big deal.
But I thought I could also just have the click "bubble up". Speaking
in UIKit terms I'd just have to "turn off user interaction" for the
view (by overriding hitTest?) and the NSToolbarItem would again
trigger the action on a click. Obviously that's not the case.
But why isn't that the case?
cheers,
Torsten
_______________________________________________
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