处理 OSX Dock 拖放

发布于 2024-07-13 22:26:41 字数 410 浏览 6 评论 0原文

我四处寻找有关如何在 OSX 中处理拖放至 Dock 的信息。 拖放文档 (http ://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/DragandDrop.html#//apple_ref/doc/uid/10000069)我发现所有处理都是从一个视图拖动到另一个视图。 如果有人能给我一些代码示例,那就太好了。

我正在使用 PyObjC 新娘编写我的应用程序,但 Cocoa 示例同样受欢迎:-)

I looked high and low for information on how to handle drag n drop to the dock in OSX. The drag n drop documentation (http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/DragandDrop.html#//apple_ref/doc/uid/10000069) I found all deal with dragging from view to view. If anyone can point me to some code samples, that would be excellent.

I'm writing my app using the PyObjC bride, but Cocoa examples would be equally welcome :-)

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

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

发布评论

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

评论(5

淡写薰衣草的香 2024-07-20 22:26:41

嗯,看来我问得太早了。 这是一个很棒的教程,展示了如何做到这一点:

http://recurser.com/articles/2007/04/13/cocoa-drag-to-dock-to-open/

基本上,只需将控制器设置为 NSApplication 的委托并实现 openFile方法。

Well, looks like I asked too soon. Here is a great tutorial that shows how one does it:

http://recurser.com/articles/2007/04/13/cocoa-drag-to-dock-to-open/

Basically, just set your controller to be the delegate of NSApplication and implement the openFile method.

菊凝晚露 2024-07-20 22:26:41

这是几周前的一个类似问题。我的回答涉及拖动文件,这就是您所说的; 另一个答案涵盖拖动数据,例如图像和文本位(不是图像文件或文本文件,而是裸数据)。

Here's a similar question from a couple weeks ago. My answer covered dragging files, which is what you're talking about; the other answer covers dragging data, such as images and bits of text (not image files or text files, but bare data).

-黛色若梦 2024-07-20 22:26:41

http:// /lethain.com/entry/2008/aug/06/cocoa-drag-and-drop-text-into-the-dock-icon/ 涵盖了使用 pyobjc 将文本拖放到停靠栏图标中。 您可以轻松地将其改编到其他文件中。

http://lethain.com/entry/2008/aug/06/cocoa-drag-and-drop-text-into-the-dock-icon/ covers dragging and dropping text into a dock icon with pyobjc. You can adapt this into other files reasonably easily.

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