简体   繁体   English

防止NSTextField变为活动状态(Cocoa OSX)

[英]Preventing an NSTextField from becoming active (Cocoa OSX)

I want my NSTextFields in my GUI to act like the text fields in the apple finder (the text only becomes active for editing if the text is clicked on when the item is selected). 我希望我的GUI中的NSTextField像苹果查找器中的文本字段一样起作用(仅当在选中该项目时单击该文本时,该文本才可用于编辑)。 I tried overwriting the mousedown method of the NSTextField to prevent the selection but this did not do the trick. 我尝试覆盖NSTextField的mousedown方法以防止选择,但这并不能解决问题。 What method do I need to override to accomplish this behavior? 我需要重写哪种方法才能完成此行为?

将文本字段的editable属性绑定到“项目”(无论如何)的selected属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM