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: Tue, 05 Dec 2006 09:12:45 -0800
- Thread-topic: problems with modal window and menu command
On or about 12/5/06 8:59 AM, thus spake "Ken Victor" <email@hidden>:
> 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?
Oh, I think the docs explain that pretty well. It's a little confusing but
it all has to do with run loops and events. m.
> 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>
>
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide - Second Edition!
http://www.amazon.com/gp/product/0596102119
Take Control of Word 2004, Tiger, and more -
http://www.takecontrolbooks.com/tiger-customizing.html
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
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