On Sep 11, 2010, at 11:07 AM, Kyle Sluder wrote:

On further review, this makes sense to me. Holding down the Control key is an explicit signal to the system that you wish to interact with the application as if it were frontmost. -acceptsFirstMouse: is useful as a guard against misclicks, not against intentional use of the Command key.

I think you meant to say 'Command key' not 'Control key'.

I just thought of a work around. Put the following code at the beginning of all mouse responder methods in the custom view.

if (![[self window] isKeyWindow]) return;

You probably want -isMainWindow instead. Otherwise panels that become key (like the Special Characters palette) will make it impossible to interact with your control.


Actually I have a subclass of NSView, it is not a control at all. It is the primary view in a document window and the user will be using the command key and mouse a lot. But it is not desirable to have the user interact with the view using the command key and mouse when the view also does not receive keyDown and keyUp events. That would be confusing. The view does custom processing on keyDown and keyUp events. (The software is a vertical market application.)

I also have an inspector panel. I tried using 'isMainWindow' but this still allows the user to interact with the view with the command key and mouse when the panel is key. But I don't think I want this.

I changed back to 'isKeyWindow' and the inspector panel works fine. I have not tried using the Fonts panel because currently there is no text functionality implemented in the view. So I think 'isKeyWindow' is what I need to use.

--Richard

_______________________________________________

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