NSMenuItem 文本字段突出显示问题

发布于 2024-08-16 18:44:33 字数 182 浏览 1 评论 0原文

我正在创建一个状态栏应用程序,需要在文本字段中输入 URL。文本字段是 NSMenuItem 的子视图。我面临的问题是,文本字段的值无法更改,只能“间接突出显示”(它不是正常的蓝色突出显示,而是灰色突出显示,并且仅在双击文本字段的值时才会出现)。

有人知道这是为什么吗?我没有禁用文本字段,但它似乎应用了只读属性或其他东西......

I am creating a Status Bar application which requires a URL being entered in a text field. The text field is a subview of the NSMenuItem. The problem I am facing though is that the value of the text field cannot be changed and only "indirectly highlighted" (it's not the normal blue highlighting but a grey one and only occurs when double clicking the value of the text field).

Does someone know why this is?The text field hasn't been disabled by me, but it seems to apply read only properties or something...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

﹏雨一样淡蓝的深情 2024-08-23 18:44:33

您的菜单很可能已打开“自动启用项目”。启用此功能(默认设置)后,您的菜单项必须具有要启用的操作和目标,这可能会禁用其内容(您的 NSTextField)。把它关掉,你应该没问题。

It's most likely your menu has "Auto Enables Items" turned on. With this on (the default), your menu items have to have an action and a target to be enabled, which is likely disabling their contents (your NSTextField). Turn it off and you should be fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文