Re: Modal Panel from Modal Window
Re: Modal Panel from Modal Window
- Subject: Re: Modal Panel from Modal Window
- From: Uli Kusterer <email@hidden>
- Date: Thu, 31 Jul 2014 12:53:17 +0200
On 25 Jul 2014, at 21:31, koko <email@hidden> wrote:
> Case 1: I display a modal widow which has a button that displays a modal panel which s a custom control.
>
> Case 2: I use this same control in the main window of the app. In this case the control responds immediately to mouse movements.
>
> In Case 1 I must click the control in order to get mouse movement.
>
> So the question is “how to get Case 2 behavior when the custom control is in a modal window”
>
> I have -setWorksWhenModal with no change in behavior.
You're not giving us enough information.
- How are you registering for mouse movement notifications? In general, you should be using a tracking area (NSTrackingArea).
- What happens when you hit the tab key in the main window, or otherwise move keyboard focus? Does that break the mouse move events? Could it be that your custom control has to have keyboard focus (be first responder) to get mouse moved events the way you're registering for them? Maybe the modal panel has a text field that has keyboard focus by default, while the main window has another item?
If these don't get you on the right track, are you using anything that is scheduled on the run loop, e.g. an NSTimer? The only difference between modal and non-modal panels is pretty much that they run in a different run loop mode NSDefaultRunLoopMode vs. NSModalPanelRunLoopMode. By default, timers, NSURLConnections and a few other things are only scheduled in default mode, so if you want them to work at another time, you need to explicitly schedule them for that mode, or they won't run until the window closes and the modal session ends.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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