R: View losing focus on menu selection SOLVED
R: View losing focus on menu selection SOLVED
- Subject: R: View losing focus on menu selection SOLVED
- From: Matteo Rossi <email@hidden>
- Date: Sat, 16 Mar 2002 00:10:01 +0100
After useless efforts on trying to give focus to the window, I was about
to let it go hoping in a deus ex-machina solution. Then I had the
intuition: switch acceptsMouseMovedEvents off before displaying menus
and turning it on after. IT WORKS !
So this is what I have done:
for Contextual menus:
- (NSMenu*) menuForEvent:(NSEvent*) event
{
....
[[view window] setAcceptsMouseMovedEvents:NO];
....
}
for main menus in my application delegate:
- (BOOL)validateMenuItem:(NSMenuItem *)item
{
NSDocument *document = [[NSDocumentController
sharedDocumentController] currentDocument];
if( document )
[[[((XCADDocument*)document) drawingView] window]
setAcceptsMouseMovedEvents:NO];
....
}
then in the view accepting mouse moved events:
- (void) mouseEntered:(NSEvent*) event
{
[[view window] setAcceptsMouseMovedEvents:YES];
}
Everything goes just fine !
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.