OSX 10.5 和 10.6 中的菜单键功能?

发布于 2024-08-08 22:23:20 字数 365 浏览 4 评论 0原文

我正在维护一个旧的 mac C/C++ 程序。它仍然基于 rsrc 文件和 OS 9 系统调用。 (是的,是的,我知道。我正试图将我的公司拖入 21 世纪,但另一位工程师仍在使用 OSX10.3.9!请可怜我)

我正在尝试获得修改器快捷方式功能。例如,Cmd-S 有效。但是,Opt-Cmd-S 会闪烁“文件”菜单,但不会执行任何操作,除非文件菜单已打开。

我查看了我的代码,发现我正在获取事件消息并将其传递给 MenuKey 以告诉我组合键代表什么菜单选项。然而,如果按下多个修饰键,MenuKey 始终返回 0。

我从苹果文档中看到,这已被弃用,但我宁愿不必重新编写整个程序以转移到笔尖等。

那么,有人有快速而肮脏的工作吗?

谢谢。

I have an OLD mac C/C++ program that I'm maintaining. It's still based on rsrc files and OS 9 system calls. (Yes, yes, I know. I'm TRYING to drag my company into the 21st century, but the other engineer is still using OSX10.3.9! please pity me)

I'm trying to get modifier shortcut functionality. Cmd-S works, for example. However, Opt-Cmd-S blinks the "File" menu, but doesn't do anything, UNLESS the file menu is already open.

I've looked through my code, and found that I'm taking the event message and passing it to MenuKey to tell me what menu option the key combo represents. However, MenuKey is always returning 0 if there are more than one modifier pressed.

I see from the apple documentation that this has been deprecated, but I'd rather not have to re-write the entire program just yet to move to nibs and so forth.

So, does anyone have a quick and dirty work around?

thanks.

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

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

发布评论

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

评论(1

沫尐诺 2024-08-15 22:23:20

嗯,几乎所有 Carbon UI 都已被弃用(尽管 MenuKey 比其他一些位更被弃用)。这并不是说它仍然不受支持,但您应该使用 Cocoa 进行任何新的开发(即使 10.3.9 上的版本也比您正在做的事情有了巨大的改进)。

如果您不习惯使用 Carbon,请务必阅读头文件;那里有很多其他地方没有的文档和有用的提示。您应该使用 MenuEvent 而不是 MenuKey; MenuKey 不支持 Command 键以外的修饰符。

Well, nearly all of the Carbon UI has been deprecated (though MenuKey is more deprecated than some other bits). That's not to say it isn't still supported, but you should do any new development with Cocoa instead (even the version on 10.3.9 is a vast improvement over what you're doing).

If you're not used to working with Carbon, make sure to read the header files; there's a lot of documentation and useful hints in there which aren't anywhere else. You should use MenuEvent instead of MenuKey; MenuKey doesn't support modifiers other than the Command key.

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