• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
R: View losing focus on menu selection SOLVED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: How do I give an IB object a custom icon?
  • Next by Date: Re: Error
  • Previous by thread: Re: Error
  • Next by thread: dd: speed up mouse with Cocoa?
  • Index(es):
    • Date
    • Thread