I have a custom popover control containing multiple sliders and textfields 
(http://dl.dropbox.com/u/4920112/Screenshots/SliderPopover.PNG).  When tabbing 
through the textfields I get the following exception:

2012-03-15 12:19:42.805 SettingsBar[7232:603] *** Assertion failure in 
+[LSPopupSliderView _findFirstKeyViewInDirection:forKeyLoopGroupingView:], 
/SourceCache/AppKit/AppKit-1138.32/AppKit.subproj/NSView.m:11103
2012-03-15 12:19:42.806 SettingsBar[7232:603] Exception detected while handling 
key input.
2012-03-15 12:19:42.806 SettingsBar[7232:603] this method is supposed to only 
be invoked on top level items
2012-03-15 12:19:42.809 SettingsBar[7232:603] (
        0   CoreFoundation                      0x9b07cb67 __raiseError + 231
        1   libobjc.A.dylib                     0x9859c149 objc_exception_throw 
+ 155
        2   CoreFoundation                      0x9afe4369 +[NSException 
raise:format:arguments:] + 137
        3   Foundation                          0x93049267 -[NSAssertionHandler 
handleFailureInMethod:object:file:lineNumber:description:] + 116
        4   AppKit                              0x9ab46d93 +[NSView 
_findFirstKeyViewInDirection:forKeyLoopGroupingView:] + 143
        5   AppKit                              0x9a5c8367 
_replacementKeyViewAlongKeyViewPath + 595
        6   AppKit                              0x9a5c8107 -[NSView 
nextValidKeyView] + 193
        7   AppKit                              0x9aa91e28 -[NSTextField 
textDidEndEditing:] + 1053
        8   Foundation                          0x92f85e25 
__-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 + 49
        9   CoreFoundation                      0x9afbccb3 
___CFXNotificationPost_block_invoke_1 + 275
        10  CoreFoundation                      0x9af87a38 _CFXNotificationPost 
+ 2776
        11  Foundation                          0x92f71012 
-[NSNotificationCenter postNotificationName:object:userInfo:] + 92
        12  AppKit                              0x9aaee107 
-[NSTextView(NSPrivate) _giveUpFirstResponder:] + 460
        13  AppKit                              0x9aad18be 
-[NSTextView(NSKeyBindingCommands) insertTab:] + 506
        14  CoreFoundation                      0x9afd1de1 -[NSObject 
performSelector:withObject:] + 65
        15  AppKit                              0x9a9cf328 -[NSResponder 
doCommandBySelector:] + 260
        16  AppKit                              0x9aac54e2 -[NSTextView 
doCommandBySelector:] + 152
        17  AppKit                              0x9aca2b81 -[NSTextInputContext 
doCommandBySelector:] + 109
        18  AppKit                              0x9ac9ec72 -[NSTextInputContext 
_handleCommand:] + 84
        19  AppKit                              0x9a8dcf67 
-[NSKeyBindingManager(NSKeyBindingManager_MultiClients) 
interpretEventAsCommand:forClient:] + 1721
        20  AppKit                              0x9aca361a -[NSTextInputContext 
handleEvent:] + 1389
        21  AppKit                              0x9ab47636 -[NSView 
interpretKeyEvents:] + 220
        22  AppKit                              0x9aab47ba -[NSTextView 
keyDown:] + 676
        23  AppKit                              0x9a50f9c3 -[NSWindow 
sendEvent:] + 10891
        24  AppKit                              0x9a4a70e7 -[NSApplication 
sendEvent:] + 4788
        25  AppKit                              0x9a4386d5 -[NSApplication run] 
+ 1007
        26  AppKit                              0x9a6cc261 NSApplicationMain + 
1054
        27  SettingsBar                         0x0000251b main + 43
        28  SettingsBar                         0x000024e5 start + 53
        29  ???                                 0x00000003 0x0 + 3
)

Thinking I might solve the problem by explicitly setting up my own key-loop I 
modified my construction and layout method thus:

- (void)setSliders:(NSArray *)sliders
{
    // Adds all of the required sliders at once.  Any sliders already existing
    // will be removed and released.  This method also has the advantage that
    // the code to resize the view to accomodate the longest slider, will only
    // run once.
    for ( MCComplexSlider * slider in _sliders )
    {
        [slider removeFromSuperview];
    }
    
    [_sliders removeAllObjects];
    
    NSTextField *prevTextField = nil;
    
    for ( MCComplexSlider *slider in sliders )
    {
        [prevTextField setNextKeyView:slider.textField];
        prevTextField = slider.textField;
        [_sliders addObject:slider];
        [self.view addSubview:slider];
    }
    
    [prevTextField setNextKeyView:[[sliders objectAtIndex:0] textField]];
    [self layoutSliders];
}

No difference in behavior.  I still get the exception and in both cases, after 
the exception is raised and dumped to the console, the program continues to run 
without incident and the key-loop is magically healed.  Having an exception 
dump to the console is not something I'm prepared to ignore.  Does anyone have 
an explanation for what is really going on here?

Thanks.

-Michael

_______________________________________________

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