Re: NSStatusItem with no menu triggers menu tracking
Re: NSStatusItem with no menu triggers menu tracking
- Subject: Re: NSStatusItem with no menu triggers menu tracking
- From: Philip George <email@hidden>
- Date: Thu, 18 Jul 2002 23:30:56 -0500
Ok, how about we look at this from a different angle...
Instead of worrying about catching a notification or an event and then
counteracting it, what if we try to stop the click from ever reaching
the menubar? Can't I specify somehow that events STOP at a certain view
and go no further? In fact, let's pretend that I have a normal
NSWindow, which holds a view, which holds another view. The
cross-section might look like:
___________ :: viewB
_____________ :: veiwA
_________________ :: window
If I click inside viewB, how can I stop that event from making it past
viewA?
Keep in mind that the view that is inside my NSStatusItem is a custom
subclass of NSImageView and already implements the mouseDown: method...
- (void)mouseDown:(NSEvent *)theEvent {
// one would think that event processing would stop right here
since I don't
// pass the event to anyone else, but obviously the event is making
it all the
// way through my statusitem and hitting the menubar underneath.
}
What other tactic should I be using to stop the event from making it all
the way through my pile of views and hitting the menubar?
- Philip
On Thursday, July 18, 2002, at 10:53 PM, Philip George wrote:
>
*This message was transferred with a trial version of CommuniGate(tm)
>
Pro*
>
didn't work. i tried several variations, but it behaves exactly the
>
same.
>
>
- Philip
>
>
>
On Thursday, July 18, 2002, at 10:46 PM, Kyle Moffett wrote:
>
>
> On Thursday, July 18, 2002, at 11:36 PM, Philip George wrote:
>
>> Kyle, actually you and I are on the same wavelength here. With this
>
>> idea though, the problem is that I can't figure out exactly how
>
>> trigger the counteraction event. I can trap the notification easily.
>
>> I just don't know exactly what to do next. Here's what I've got to
>
>> trap the notification. I only need a way to trigger the disabling of
>
>> menu tracking once inside the handler method...
>
>>
>
>> ...
>
>> // in my startup code
>
>> [[NSDistributedNotificationCenter defaultCenter] addObserver:self
>
>> selector:@selector(menuTrackingHandler:)
>
>> name:@"com.apple.HIToolbox.beginMenuTrackingNotification"
>
>> object:nil
>
>>
>
>> suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]
>
>> ;
>
>> ....
>
>>
>
>> // in the same class...
>
>> - (void)menuTrackingHandler:(NSNotification *)n {
>
>> NSLog(@"%@",[n name]);
>
>> // Okay, I can get to this point fine, but what do I do
>
>> // inside this method to RE-trigger the opposite
>
>> // event, thus disabling menu tracking?
>
>> // that's the part I can't figure out.
>
> // Try this:
>
> [NSDistributedNotificationCenter defaultCenter]
>
> postNotificationName:@"com.apple.HIToolbox.beginMenuTrackingNotification"
>
> object:myStatusItem
>
> userInfo:[n userInfo]
>
> deliverImmediately:YES];
>
> // It might not work, but you could try.
>
>> }
>
>>
>
>> Thanks.
>
>>
>
>> - Philip
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.