I'm having responder chain headaches.  Here's my stack of objects:

RSWindow with custom - sendEvent: to capture and handle with trackingRect for 
webView mouse activity.

When the user clicks I create a viewController and add the view as a subview to 
the RSWindow.
The viewController provides - deleteLocator: which invokes [[self view] 
removeFromSuperview]. 

A right click on a subview opens a context menu with two options: Edit or 
Delete. Delete should remove the subview from the RSWindow.

My issue is with wiring up the menu to the NSResponder chain. When I connect 
the Delete menu item to the FirstReponder action in IB the event never fires. 
If I connect the Delete button directly to the viewController's deleteLocator: 
action outlet the event gets hung up in the RSWindow sendEvent:  else { [super 
sendEvent:theEvent] } .

Here is a partial of the NSLog dump:

2012-04-15 12:57:59.705 Trixie[5098:503] -[RSAppDelegate init]- [0019] 
2012-04-15 12:58:04.299 Trixie[5098:503] -[NSCarbonMenuImpl deleteLocator:]: 
unrecognized selector sent to instance 0x7f837d2b22a0
2012-04-15 12:58:04.300 Trixie[5098:503] An uncaught exception was raised
2012-04-15 12:58:04.300 Trixie[5098:503] -[NSCarbonMenuImpl deleteLocator:]: 
unrecognized selector sent to instance 0x7f837d2b22a0
2012-04-15 12:58:04.302 Trixie[5098:503] (
        0   CoreFoundation                      0x00007fff93220f56 
__exceptionPreprocess + 198
        1   libobjc.A.dylib                     0x00007fff867d1d5e 
objc_exception_throw + 43
        2   CoreFoundation                      0x00007fff932ad1be -[NSObject 
doesNotRecognizeSelector:] + 190
        3   CoreFoundation                      0x00007fff9320de23 
___forwarding___ + 371
        4   CoreFoundation                      0x00007fff9320dc38 
_CF_forwarding_prep_0 + 232
        5   CoreFoundation                      0x00007fff9321070d -[NSObject 
performSelector:withObject:] + 61
        6   AppKit                              0x00007fff8ae20ffa 
-[NSApplication sendAction:to:from:] + 139
        7   AppKit                              0x00007fff8af0e323 -[NSMenuItem 
_corePerformAction] + 399
        8   AppKit                              0x00007fff8af0e05a 
-[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 125
        9   AppKit                              0x00007fff8b1ad4d4 -[NSMenu 
_internalPerformActionForItemAtIndex:] + 38
        10  AppKit                              0x00007fff8b03c1bd 
-[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 138
        11  AppKit                              0x00007fff8ae87e93 
NSSLMMenuEventHandler + 339
        12  HIToolbox                           0x00007fff88564478 
_ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec 
+ 1263
        13  HIToolbox                           0x00007fff88563a84 
_ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec
 + 446
        14  HIToolbox                           0x00007fff8857a923 
SendEventToEventTarget + 76
        15  HIToolbox                           0x00007fff885c09c5 
_ZL18SendHICommandEventjPK9HICommandjjhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef
 + 398
        16  HIToolbox                           0x00007fff886a8035 
SendMenuCommandWithContextAndModifiers + 56
        17  HIToolbox                           0x00007fff886ef7a9 
SendMenuItemSelectedEvent + 253



Clearly I am misunderstanding some aspect of the menu-to-Respnder chain setup.  
Any thoughts?

It occurs to me I may be trying to remove the viewController from within the 
viewController - a lifting-by-the-bootstraps problem ?  Should I make the 
RSWindow do the removal/deletion ? Or AppDelegate ?



Erik Stainsby
[email protected]




_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to