问题描述
例如,当我点击下面的红点:$ b $ b
For example when I click on the red dot below:
我想要取消选中以下内容:
I want the following deselection to occur:
>
我使用绑定为数据源和选择索引设置基于视图的NSOutlineView。到目前为止,我试图重写的TableCellView的becomeFirstResponder和也重写NSOutlineView的becomeFirstResponder,但它似乎NSOutlineView从来没有实际放弃第一响应者状态?
I set up the view-based NSOutlineView using bindings for both the data source and the selection indexes. So far i've tried to override the TableCellView becomeFirstResponder and also override NSOutlineView's becomeFirstResponder however it seems NSOutlineView never actually gives up first responder status?
一些建议会非常感谢。
推荐答案
的主题。该解决方案似乎是创建 NSOutlineView
的子类,并覆盖 mouseDown:
,以便您可以确定点击是在行上或不行。当点击在一个行,你只是分派到超级。如果不是你向 NSOutlineView
发送 deselectAll:
。
I found this post on the topic. The solution appears to be in creating a subclass of NSOutlineView
and overriding mouseDown:
so that you can determine whether the click was on a row or not. When the click is on a row you just dispatch to super. If it's not you send deselectAll:
to your NSOutlineView
.
我没有尝试过自己,但有各种帖子提出了类似的代码。
I haven't tried it myself but there are various posts around which come up with comparable code.
这篇关于如何在单击视图的空白空间时取消选择NSOutlineView中的所有表行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!