如何使控件“可选项化”当从 Cocoa 应用程序中的插件加载时?

发布于 2024-09-05 07:30:18 字数 337 浏览 11 评论 0原文

我有一个应用程序加载有自己的 UI 的插件。 我的AppDelegate中有一个名为ContainerView的IBOutlet。 当插件加载时,它将自己的视图(存储在插件包的 xib 中)放入容器视图中,如下所示
[ContainerView addSubview:viewFromPlugin];

当视图加载时,一切都很好,但是当我按 Tab 时,唯一获得焦点的控件是 ContainerView 外部的控件,而其中的控件都没有获得焦点。
我尝试将容器视图设置为initialFirstResponder,并尝试将选项卡顺序中最后一个按钮的nextKeyView 连接到ContainerView。

谢谢。

I have an application thad loads in plugins that have their own UI.
There is an IBOutlet called ContainerView in my AppDelegate.
When the plugin loads, it puts its own view (that is stored in a xib in the plugin bundle) into the Container view like so
[ContainerView addSubview:viewFromPlugin];

When the view loads, everything is fine but when I press tab the only controls that get any focus are ones outside of the ContainerView and none of them inside it get focus.
I've tried setting the container view as the initialFirstResponder and I've tried hooking up the nextKeyView from the last button in the tab order to the ContainerView.

Thanks.

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

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

发布评论

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

评论(2

你在我安 2024-09-12 07:30:18

我尝试将容器视图设置为initialFirstResponder,并尝试将tab顺序中最后一个按钮的nextKeyView连接到ContainerView。

这就是你想做的吗?让容器视图成为关键视图?听起来不像。听起来您希望插件视图(或其中的视图)成为关键视图。

Apple 文档的这一部分解释了所有键视图循环的不同方面。 我相信您会想要设置容器视图的 nextKeyView 以及它之前的视图,或者覆盖容器视图的 nextValidKeyView 方法——可能两者兼而有之。您还可以尝试将前一个视图的 nextKeyView 直接设置为插件视图的 nextValidKeyView,完全跳过容器视图。

I've tried setting the container view as the initialFirstResponder and I've tried hooking up the nextKeyView from the last button in the tab order to the ContainerView.

Is that what you want to do? Make the container view the key view? It doesn't sound like it; it sounds like you want the plug-in view (or a view within it) to become the key view.

This section of the Apple documentation explains all of the different aspects of the key view loop. I believe you'll want to either set the nextKeyView of the container view as well as the view before it, or override the container view's nextValidKeyView method—possibly both. You might also try setting the previous view's nextKeyView directly to the plug-in view's nextValidKeyView, skipping over the container view entirely.

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