不使用时自动隐藏工具栏

发布于 2024-09-02 06:13:52 字数 357 浏览 2 评论 0原文

我正在为 Mac OS 10.6 创建一个 Cocoa 应用程序,并且我想在至少 30 秒不使用 NSWindow 时自动隐藏它的工具栏。 我认为这可以用 NSTimers 来完成,但我对它们不熟悉,我不知道如何实现它。

另一个问题是 NSToolbarDelegate 和 NSWindowDelegate 协议都没有像 toolbarDidShow: 这样的委托方法,

有人能给我指出正确的方向吗?谢谢。


附言。这并不是为了惩罚用户,而是为用户提供一个更干净的窗口(该窗口仅包含一个用于颜色和字体的工具栏以及一个文本视图)。


聚苯硫醚。用户打字时隐藏工具栏动画会导致光标出现问题吗?

I am creating a Cocoa Application for Mac OS 10.6 >, and I want to hide the toolbar of an NSWindow automatically when it is not in use for at least 30 seconds.
I think this can be done with NSTimers, but I'm not familiar with them and I don't know how I can implement this.

Another problem is that both the NSToolbarDelegate and NSWindowDelegate protocols don't have delegate methods like toolbarDidShow:

Can anyone point me in the right direction? Thanks.


PS. This is not to punish the user, but rather give the user a cleaner window (the window consist of only a toolbar for color and font and a text-view).


PPS. Can the hide-toolbar-animation lead into a problem with the cursor while the user is typing?

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

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

发布评论

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

评论(1

野生奥特曼 2024-09-09 06:13:52

我认为这可以用 NSTimers 来完成,但我对它们不熟悉,也不知道如何实现它。

计时器编程指南可能会对您有所帮助。显示和隐藏工具栏很容易,使用 -setVisible:。此外,-isVisible 可用于确定工具栏的可见性。

I think this can be done with NSTimers, but I'm not familiar with them and I don't know how I can implement this.

The Timer Programming Guide might help you here. It's easy enough to show and hide the toolbar, use -setVisible:. Also, -isVisible can be used to determine the visibility of the toolbar.

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