Skip navigation.
 
mlRe: event/notification for focus?
FROM : Luc Vandal
DATE : Fri Apr 08 21:35:59 2005

Hi,

I managed to get it to work by changing NSPostASAP to NSPostNow (hoping
that this is ok).

One last thing, how can I get information about the control from
NSResponder?

Thanks!

Luc


On 8-Apr-05, at 1:33 PM, Shawn Erickson wrote:

>
> On Apr 8, 2005, at 9:46 AM, Luc Vandal wrote:
>

>>
>> On 8-Apr-05, at 12:43 PM, Shawn Erickson wrote:
>>

>>>
>>> On Apr 8, 2005, at 9:29 AM, Luc Vandal wrote:
>>>

>>>> Basically there's a text field, check boxes, radio buttons and
>>>> buttons. Like I said, makeFirstResponder is called every time I tab
>>>> through the controls but the notification is only received once,
>>>> when the window has closed.

>>>
>>> How did you subscribe to the notification? Did you try using the
>>> delegate pathway?
>>>
>>> >From the code I see I don't see why you would be getting the
>>> behavior you described.
>>>
>>> Are you running any type of run loop of your own while this window
>>> is up?
>>> Is it a modal window of some type?
>>>
>>> -Shawn

>>
>> here's how I register:
>>
>> NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
>>     
>>     [center addObserver:self
>>                          selector:@selector(windowDidMakeFirstResponder:)
>>                                  name:@"WindowDidMakeFirstResponder" object:nil];

>
> Is the window you are working with a modal window... application
> modal, document modal (sheet), etc.?
>
> My guess would be that you either have a sub-runloop in place or the
> main runloop is in a particular mode while the window is being
> displayed that is preventing delivery of the notification.
>
> As a test you could modify the NSWindow subclass to change the modes
> that the event should be delivered under.
>
> Replace...
>
> [[NSNotificationQueue defaultQueue] enqueueNotification:notif
> postingStyle:NSPostASAP];
>
> ...with something like the following (consider adding
> NSEventTrackingRunLoopMode as well if needed)...
>
> NSNotificationQueue dq = [NSNotificationQueue defaultQueue]
> [dq enqueueNotification:notif
>            postingStyle:NSPostASAP
>            coalesceMask:NSNotificationCoalescingOnName |
> NSNotificationCoalescingOnSender
>                forModes:[NSArray
> arrayWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode, nil]];
>
> -Shawn

Related mailsAuthorDate
mlevent/notification for focus? Luc Vandal Apr 6, 20:57
mlRe: event/notification for focus? Ricky Sharp Apr 6, 21:58
mlRe: event/notification for focus? ttempel Apr 7, 00:48
mlRe: event/notification for focus? Luc Vandal Apr 7, 01:58
mlRe: event/notification for focus? Dustin Voss Apr 7, 02:22
mlRe: event/notification for focus? Mike Ferris Apr 7, 16:41
mlRe: event/notification for focus? Luc Vandal Apr 7, 17:50
mlRe: event/notification for focus? Ricky Sharp Apr 7, 17:58
mlRe: event/notification for focus? Luc Vandal Apr 7, 18:26
mlRe: event/notification for focus? j o a r Apr 7, 18:36
mlRe: event/notification for focus? Shawn Erickson Apr 7, 18:41
mlRe: event/notification for focus? Luc Vandal Apr 7, 18:46
mlRe: event/notification for focus? j o a r Apr 7, 18:51
mlRe: event/notification for focus? Luc Vandal Apr 7, 19:07
mlRe: event/notification for focus? Ricky Sharp Apr 7, 19:15
mlRe: event/notification for focus? Shawn Erickson Apr 7, 19:29
mlRe: event/notification for focus? Shawn Erickson Apr 7, 20:48
mlRe: event/notification for focus? Luc Vandal Apr 7, 22:02
mlRe: event/notification for focus? Luc Vandal Apr 8, 18:06
mlRe: event/notification for focus? Shawn Erickson Apr 8, 18:18
mlRe: event/notification for focus? Shawn Erickson Apr 8, 18:22
mlRe: event/notification for focus? Luc Vandal Apr 8, 18:29
mlRe: event/notification for focus? Shawn Erickson Apr 8, 18:43
mlRe: event/notification for focus? Luc Vandal Apr 8, 18:46
mlRe: event/notification for focus? Luc Vandal Apr 8, 19:17
mlRe: event/notification for focus? Shawn Erickson Apr 8, 19:33
mlRe: event/notification for focus? Luc Vandal Apr 8, 21:35
mlRe: event/notification for focus? Shawn Erickson Apr 8, 21:45