检测选项卡视图更改Xcode OSX AppleScriptObjC

时间:2013-05-31 00:01:14

标签: xcode macos events applescript applescript-objc

我正在AppleScriptObjC中构建一个应用程序,我有一个初学者的问题 - 如何处理点击我的应用程序中的标签按钮?我试图让每个标签有不同的大小。我可以调整窗口大小,但不能单击选项卡。无论如何,我已将标签视图连接到委托 enter image description here

等,并添加了didSelectTabView函数,如下所示:

on didSelectTabViewItem_(tabItem)
    display alert "Testing"
end didSelectTabViewItem_

...我收到以下错误:

2013-05-30 18:50:10.970 MacUtil[16354:303] Error setting value for key path self of object <AppDelegate @0x1005d3040: OSAID(4)> (from bound object <NSTabView: 0x101c05490>): [<AppDelegate 0x1005d3040> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key self.
2013-05-30 18:50:10.972 MacUtil[16354:303] (
    0   CoreFoundation                      0x00007fff911210a6 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff9522e3f0 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff91120ee8 +[NSException raise:format:arguments:] + 104
    3   AppKit                              0x00007fff92e3414c -[NSBinder _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:] + 902
    4   AppKit                              0x00007fff92e33d6d -[NSBinder setValue:forBinding:error:] + 248
    5   AppKit                              0x00007fff93493625 -[NSViewStateBinder _setValue:forBinding:errorFallbackMessage:] + 63
    6   AppKit                              0x00007fff933a5198 -[NSTabViewBinder tabView:didSelectTabViewItem:] + 330
    7   AppKit                              0x00007fff934b9c75 -[_NSBindingAdaptor tabView:didSelectTabViewItem:] + 136
    8   AppKit                              0x00007fff92fe9029 -[NSTabView selectTabViewItem:] + 1172
    9   AppKit                              0x00007fff9303ea8c -[NSTabView mouseDown:] + 156
    10  AppKit                              0x00007fff92fad60e -[NSWindow sendEvent:] + 6853
    11  AppKit                              0x00007fff92fa9744 -[NSApplication sendEvent:] + 5761
    12  AppKit                              0x00007fff92ebf2fa -[NSApplication run] + 636
    13  AppKit                              0x00007fff92e63cb6 NSApplicationMain + 869
    14  MacUtil                             0x0000000100000f0a main + 74
    15  libdyld.dylib                       0x00007fff93a297e1 start + 0
    16  ???                                 0x0000000000000003 0x0 + 3
)

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

解决!我只需在你将它绑定到app delegate的地方取消选中“不适用键的引发”。它之所以这样做,是因为我没有为标签视图事件处理实现所有方法。