Re: problems with modal window and menu command
Re: problems with modal window and menu command
- Subject: Re: problems with modal window and menu command
- From: Matt Neuburg <email@hidden>
- Date: Mon, 04 Dec 2006 19:15:37 -0800
- Thread-topic: problems with modal window and menu command
On Mon, 4 Dec 2006 17:01:08 -0800, Ken Victor <email@hidden> said:
>i've got an NSWindow that is displayed via:
> [NSApp runModalForWindow:]
>this window has a default button whose target is my subclass of
>NSWindowController (which is setup at the nib's owner in IB) and an
>action method in my subclass. if i click on this button or type
>"enter" then everything works as it should.
>
>however, i also have a menu item whose target is set to
>firstResponder in IB and has the same action as the default button
>above. if i select this menu item via its keyboard shortcut, again,
>everything works properly.
>
>and now for the wierdness that has been driving me crazy all day: if
>i select the menu item with the mouse and am very careful to not move
>the mouse after the selection and to not jiggle any keys on my
>keyboard, then, while the apprpriate action method is called (which
>calls stopModal btw), control never returns to the instruction after
>the above runModalForWindow. i can wait indefinetly, and i never get
>control back. now if i move the mouse or type on the keyboard,
>everything resumes normal operation!
>
>i'm at a loss as to what is going wrong. i'd appreciate any and all
>advice/suggestions as to how to figure out what is going wrong and/or
>how to fix this. pointers to appropriate documention also welcome.
>or... in other words, any help GREATLY appreciated.
Great description, Ken - I was able to reproduce this in five minutes with
just three lines of code. I wish everyone would pose questions this way.
In the case where the user is choosing the menu, call abortModal instead of
stopModal and you should be fine. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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