问题标签 [nscursor]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1369 浏览

cocoa - How to get LIon's window resize NSCursor?

The NSCursor documentation lists a number of resize cursors, but they are all of the variety used to resize panes inside of a window: NSCursor Reference

How do I get the resize cursors which OS X uses for resizing window borders?
(I.e., the arrows without the bar in the middle.)

0 投票
1 回答
210 浏览

objective-c - NSWindow 附加到光标

我想制作一个自定义面板,显示当前光标位置的缩放。就像“Sip”一样。我在网上搜索了示例,但没有找到任何具体的内容。

我找到了NSEvent'saddGlobalMonitorForEventsMatchingMask:handler:addLocalMonitorForEventsMatchingMask:handler:方法。现在我可以设置窗口的框架原点。但我不确定这是否真的是正确的解决方案。

有一个更好的方法吗?谁能指出我一些示例代码?

0 投票
1 回答
776 浏览

objective-c - 如何将 Mac 彩色加载光标设置为 NSImageView?

我知道当鼠标进入 NSImageView 时如何设置 NSCursor,但我找不到设置这个特定光标的方法:
在此处输入图像描述

我该如何设置这个?

0 投票
2 回答
320 浏览

objective-c - 如何将对象附加到 NSCursor?操作系统

当用户悬停按钮时,我想将 WebView 附加到光标上。并在鼠标退出时将其删除。
即使光标在按钮内移动,我也希望 WebView 继续跟随光标。
关于如何执行此操作的任何想法?

这是一个关于它应该如何的例子:
在此处输入图像描述

0 投票
1 回答
780 浏览

objective-c - NSCursor 设置不适用于未聚焦的窗口

编辑:我在 GitHub 上创建了一个小型 XCode 项目,复制了我所描述的问题:https ://github.com/mdinacci/testnscursor

我有一个习惯NSTableCellView,我在其中跟踪鼠标进入/退出事件NSTextField。当鼠标进入该字段时,我将光标更改为指向手:

表格显示在 anNSPopover中,当弹出框处于焦点时,上面的代码可以很好地工作,但在弹出框未获得焦点时就不行了。单元格视图确实接收进入/退出事件,但光标根本不会更新。

这是一个错误吗?任何想法为什么当弹出框不在焦点时光标不会更新?

0 投票
3 回答
1411 浏览

cocoa - cursorUpdate 调用,但游标未更新

我已经为此工作了几个小时,不知道出了什么问题。我想要一个按钮的自定义光标,它是 NSTextView 的子视图,我添加了一个跟踪区域并在鼠标输入按钮时发送 cursorUpdate 消息。

每次鼠标进入跟踪区域时,确实会调用 cursorUpdate 方法。但光标停留在 IBeamCursor。

有任何想法吗?

Apple Docs 参考:管理光标更新事件

0 投票
2 回答
1725 浏览

objective-c - 当光标悬停在 NSTextView 内的 NSButton 时,如何强制光标成为“arrowCursor”?

好的,这是问题所在:
我有一个NSTextView并且我添加了我的自定义NSButton使用:

然后,在我的NSButton子类中,我有(连同这些NSTrackingArea东西):

但是当我将它悬停时,光标保持不变IBeamCursor(因为它是 a NSTextView)。只有当我按下按钮时,光标才会更新。然后,当我移动鼠标时,仍然在按钮内,光标回到IBeamCursor.

关于如何做到这一点的任何想法?谢谢!

0 投票
1 回答
1480 浏览

xcode - XCode 等待光标显示

我想在用户单击按钮时显示等待光标,然后在操作结束时显示正常光标。我能怎么做 ?我在 mac developer center 上读到等待光标是原生的。

0 投票
0 回答
432 浏览

objective-c - NSCursor 的消失ItemCursor 不在窗口外设置

我有一个包含NSTableView. 当一行被拖到表格外时(拖放在这里完全有效,这不是问题的重点)我将光标更改为 poofy-pointer,否则称为[NSCursor disappearingItemCursor]

这是非常不可靠的,因为它有时有效,有时无效。它通常在第一次尝试时起作用,但在那之后就退出了。我似乎找不到我拖过的东西的模式,或者拖了多远等等......,只是它看起来很不稳定。我在这里做错了吗?如果没有,我可以做些什么来帮助诊断问题吗?




更新
我也尝试了push/pop路线,问题仍然存在。




更新
我也尝试过使用该sourceOperationMaskForDraggingContext方法来设置它。我可以确认在正确的时间调用了正确的部分,但是在走这条路线时光标永远不会改变。

0 投票
1 回答
1629 浏览

macos - NSCursor: Using high-resolution cursors with cursor zoom (or retina)

In OSX the user can zoom the mouse cursor using the accessibility system preferences. Since Lion (I think) OSX stores the cursors as PDFs and is able to resize them smoothly. I want the same functionality for my app but using PDFs as the NSImage used for my NSCursor just scales up the rendered bitmap when a cursor zoom level larger than 1.0 is set.

How do I:

  • Use vector artwork for my cursors and have them scale correctly like the system cursors do?
  • Detect the current cursor zoom level.
  • Get notified when the cursor zoom level changes?

Also, when using a HiDPI mode for my screen and revert the cursor zoom setting, the PDF cursor is blurred as well so how exactly do you guys retina-ify your cursors?