Solved. The problem was caused by the view concerned having a menu set with setMenu:. With that remove it now gets mouseDown: with control held down.
Many thanks for your thoughts. On 18 May 2014, at 01:44, Tim Hewett <[email protected]> wrote: > As a test I have replaced the TrackView view with my own view in the > MenuItemView sample code mentioned previously, still creating it > programatically as in my own code, and it now gets mouseDown: with control > held down no problem. > > So clearly the issue is nothing to do with how the view is created or some > setting in the view class hierarchy. I suspect something to do with the way > the app is started and its environment - it is created without any XIB as it > is a user agent started by launchd and has no “.app” folder hierarchy, just a > standalone executable which only creates a status bar menu item. It sets > itself up as a delegate to NSApplication in main() and starts everything in > applicationDidFinishLaunching:. > > The MenuItemView sample code is a more conventional Cocoa app with a XIB file > etc. so maybe NSApplication (or other things) has different default settings. > > No obviously-related setting has been discovered in NSApplication as yet and > things tried so far have made no difference. > > > On 17 May 2014, at 02:46, Lee Ann Rucker <[email protected]> wrote: > >> NSView handles rightMouseDown: differently - it calls calls menuForEvent: >> Documentation says in 10.7+ it should pass it up the responder chain, so you >> ought to get it. >> >> I'd put a symbolic break on -[NSView rightMouseDown:] and see if it's being >> called; that might shed some light on where it's going. >> >> >> On May 16, 2014, at 8:11 AM, Tim Hewett wrote: >> >>> I have tried that too, no message for that either. >>> >>> Tim. >>> >>> >>> On 16 May 2014, at 14:30, Eric Shepherd <[email protected]> wrote: >>> >>>> Try implementing rightMouseDown: instead for that. >>>> >>>> Eric Shepherd >>>> >>>>> On May 15, 2014, at 12:39 PM, Tim Hewett <[email protected]> wrote: >>>>> >>>>> I have a NSMenuItem with a custom view (inheriting from NSImageView) >>>>> which needs to react to mouseDown: events. An NSTrackingArea has been >>>>> setup for the view’s frame to enable this. >>>>> >>>>> When getting the events the modifierFlags are used to change behaviour, >>>>> but this doesn’t work when control is held down - no mouseDown: event >>>>> occurs at all (no problem with other modifier keys). >>>>> >>>>> If mouseDown: is called with no modifier keys held down and then control >>>>> is pressed, this can be seen in the modifier flags when the mouseUp: >>>>> event occurs. >>>>> >>>>> The TrackView in the MenuItemView sample code has been tested and gets >>>>> mouseDown: events including when control is held down, the only >>>>> difference seems to be that the view in that sample is defined in a XIB >>>>> while the problem code’s view is created programmatically. >>>>> >>>>> Is there a way that this app can get mouseDown: events when control is >>>>> being held down? >>>>> _______________________________________________ >>>>> >>>>> Cocoa-dev mailing list ([email protected]) >>>>> >>>>> 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: >>>>> https://urldefense.proofpoint.com/v1/url?u=https://lists.apple.com/mailman/options/cocoa-dev/the.sheppy%2540gmail.com&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=yJFJhaNnTZDfFSSz1U9TSNMmxGyib3KjZGuKfIhHLxA%3D%0A&m=coyti1S6AoDBJ2Iq%2Fk5SXe5EGAtaBJ%2Bgszt9rNM7m3w%3D%0A&s=b1221be697f631761fc1d184ddac0643151429eb9f0d0ae13640be539a1abfea >>>>> >>>>> This email sent to [email protected] >>> >>> >>> _______________________________________________ >>> >>> Cocoa-dev mailing list ([email protected]) >>> >>> 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: >>> https://urldefense.proofpoint.com/v1/url?u=https://lists.apple.com/mailman/options/cocoa-dev/lrucker%2540vmware.com&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=yJFJhaNnTZDfFSSz1U9TSNMmxGyib3KjZGuKfIhHLxA%3D%0A&m=coyti1S6AoDBJ2Iq%2Fk5SXe5EGAtaBJ%2Bgszt9rNM7m3w%3D%0A&s=33471d3a07dc528a4858e0d13d5e9f329ec1849e4e8473187f9e0e7577cf6e73 >>> >>> This email sent to [email protected] > _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
