Nspopover蜂鸣器中的Nstextfield,而不是向目标发送操作(文档)

发布于 2025-02-11 13:24:18 字数 500 浏览 0 评论 0原文

我有一个基于文档的可可(MAC)/Objective-C应用程序。我在文档窗口的视图中的一个视图上展示了一个弹出声; POPOVER仅包含一个Nstextfield,其目标是第一响应者(我还尝试将其直接接线到文件的所有者,即文档),并且其操作是我的NSDocument子类响应的选择器。

问题是,当我在我的领域返回时,它只是对我发出哔哔声。它似乎不会将操作发送给文档。该文档当然不会收到它。

(我可以在字段中键入可以很好地输入,但是当我想发送该字段的操作时,它会拒绝。)

调试器控制台中没有例外。

我已经确认(通过在validateUserInterfaceItem:然后打开菜单中的调试器中闯入debugger),该字段的目标和操作是按预期设置的。我确实使用了Debugger在文档类中报告的选择器来确认选择器的确正确(没有错别字)。

我会注意到validateUserInterFaceItem:在返回键拼线上未调用。我不记得是否应该通过文本字段来调用。

I have a document-based Cocoa (Mac)/Objective-C application. I'm showing a popover on one of the views in my document window's view; the popover contains only an NSTextField, whose target is the first responder (I have also tried wiring it directly to the File's Owner, which is the document) and whose action is a selector that my NSDocument subclass responds to.

Problem is, when I press return in my field, it just beeps at me. It does not appear to send the action to the document. The document certainly doesn't receive it.

(I can type into the field just fine, but when I want to send the field's action, it refuses.)

There are no exceptions logged in the debugger console.

I have confirmed (by breaking in the debugger in validateUserInterfaceItem: and then opening a menu) that the field's target and action are set as expected. I did a Find using the selector reported by the debugger in my document class to confirm that the selector is indeed correct (no typos).

I'll note that validateUserInterfaceItem: isn't called on the return key-press. I don't remember whether it's supposed to get called by text fields or not.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文