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: Ken Victor <email@hidden>
- Date: Tue, 5 Dec 2006 08:59:19 -0800
matt,
thanx much. using abortModal instead of stopModal, when using the
menu, solves the problem (and saves my mind).
so now, i'm just very curious. can anyone explain why this works with
abortModal and not with stopModal?
thanx,
ken
At 7:15 PM -0800 12/4/06, Matt Neuburg wrote:
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