NSColorPanel阻塞鼠标向上事件 [英] NSColorPanel blocking mouse up events

查看:206
本文介绍了NSColorPanel阻塞鼠标向上事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的NSColorWell设置为不断更新。我需要知道用户何时完成从颜色面板中的颜色选择器编辑控件(鼠标向上)。

I am using a NSColorWell which is set to continuously update. I need to know when the user is done editing the control (mouse up) from the color picker in the color panel.

我安装了一个事件监视器,并成功接收鼠标移动和鼠标移动的消息,但是NSColorPanel似乎阻止了鼠标。

I installed an event monitor and am successfully receiving mouse down and mouse moved messages, however NSColorPanel appears to block mouse up.

底线是,我想将最终选择的颜色添加到我的撤消堆栈,而不会在用户选择他们的选择时生成所有中间颜色。

The bottom line is that I want to add the final selected color to my undo stack without all the intermediate colors generated while the user is choosing their selection.

是否有一种方法来创建自定义NSColorPanel并替换共享面板的想法覆盖其mouseUp和发送消息?

Is there a way of creating a custom NSColorPanel and replacing the shared panel with the thought of overriding its mouseUp and sending a message?

在我的研究中,这个问题

In my research this issue has been broached on a few occasions, however I have not read a successful resolution.

此致,
- George Lawrence Storm,Keencoyote发明服务

Regards, - George Lawrence Storm, Keencoyote Invention Services

推荐答案

在界面生成器中,选择您的颜色,然后取消选中属性检查器中的连续复选框。另外,在 applicationDidFinishLaunching:方法或 awakeFromNib 方法中适当地添加以下代码行:

In the Interface Builder, select your color well, and then uncheck the Continuous checkbox in the Attributes Inspector. Additionally, add the following line of code somewhere appropriate like in the applicationDidFinishLaunching: method or awakeFromNib method:

[[NSColorPanel sharedColorPanel] setContinuous:NO];

换句话说,共享颜色面板和颜色需要连续设置为 NO ,以便正常工作。

In other words, both the shared color panel and your color well need to have continuous set to NO in order for this to work properly.

这篇关于NSColorPanel阻塞鼠标向上事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆