应用程序可以将剪贴板用于其自身目的吗? (阅读:谁拥有剪贴板?)
在 PowerBuilder 的 IDE 中,代码自动完成功能使用剪贴板将完成的文本传送到代码窗口。 通过这样做,它会覆盖之前存储在剪贴板上的任何内容。 因此,如果您的剪贴板上存储了下一次彩票的中奖号码,并且您使用自动完成功能将 m_goodfor 转换为 m_goodfornothing,那么您就失去了唯一的机会变得富有,而你的剪贴板上什么都没有了。
类似的功能是我讨厌软件的原因。 看起来它是由某个没有人照顾的实习生实施的。 然而,也有可能我的所有努力都是徒劳的,并且这样使用剪贴板是绝对合法的。 那么,应用程序可以将剪贴板用于其自己的目的吗? 谁被认为是剪贴板的所有者?
(奖励投票给那些将自己置于该功能程序员位置的人,并提供一些故意这样做的理由,假设用户实际上会从中受益)
In PowerBuilder's IDE, the code autocomplete feature uses the clipboard to communicate the completed text to the code window. By doing so, it overrides whatever was stored on the clipboard before. So, if you had the winning numbers of the next lottary stored on your clipboard, and you used the autocomplete to turn m_goodfor into m_goodfornothing, you've just lost your only chance of ever getting rich, and you're left with nothing on your clipboard.
Features like that are the reason I hate software. It looks like it was implemented by some intern that noone was looking after. However, there's also a chance I got all worked up for nothing, and making such use of the clipboard is absolutely legit. So, can an app use the clipboard for its own purposes? Who is considered the owner of the clipboard?
(Bonus votes to whoever puts himself in place of the feature's programmer, and provides some reasoning for this being done on purpose, assuming the users would actually benefite from it)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您对实习生的推理可能是正确的。 除了纯粹的懒惰之外,应用程序绝对没有理由使用剪贴板来传达信息。 即使在进程之间,也有其他更好的信息通信方式。
除了让用户将信息粘贴到另一个应用程序中之外,没有理由使用剪贴板。
You are probably right on the intern reasoning. There is absolutely no reason why an application would use the clipboard to communicate information other than pure laziness. Even between processes, there are other, better ways of communicating information.
Other then letting the user paste information in another application, there is no reason to use the clipboard.
程序员这样做是因为它很容易,并将他的需求置于最终用户的需求之上。 有许多程序可以执行此操作,特别是 Outlook、VB 等的加载项,它们将其按钮复制/粘贴到工具栏上。 任何运行剪贴板扩展程序(例如我自己的 ClipMate)的用户都绝对会讨厌这种行为(并且您将立即被“击败”)。
这是我在这个主题上最喜欢的一句话:
“如果没有用户的明确指示,程序不应该将数据从剪贴板传输到我们的系统中。”
— Charles Petzold,《Windows 3.1 编程》,微软出版社,1992 年
The programmer did it because it was easy, and put his needs above those of the end user. There are many programs that do this, particularly add-ins to outlook, VB, etc., which copy/paste their buttons onto the toolbar. Any user that runs a clipboard extender (like my own ClipMate) will absolutely hate this behavior (and you'll be "busted" right away).
Here is my favorite quote on the subject:
“Programs should not transfer data into our out of the clipboard without an explicit instruction from the user.”
— Charles Petzold, Programming Windows 3.1, Microsoft Press, 1992
如果用户没有启动该操作,应用程序永远不应该更改剪贴板上的任何内容。 无论如何,我的.02。
An app should never change anything on the clipboard without the user initiating that action. My .02 anyway.
使用剪贴板进行应用程序通信
Using clipboard for application communication
它们总是更好的方法。 程序员可能会这样做,因为实现 OR 更快,因为他确实希望在操作之后将这个值保留在剪贴板中。 至少,如果他不想将其放入剪贴板,他可以从剪贴板获取值,存储其值,然后替换剪贴板内的旧内容,一切都会更加“透明”让最终用户感到沮丧。
They are always a better way to do it. The programmer might have done it this way because it was faster to implement OR because he really wanted to have this value in the clipboard after the action. At least, if he didn't wanted to have it in the clipboard he could have get the value from the clipboard, store its value then replace the old content of the clipboard inside the clipboard and everything would have be more "transparent" ans less frustrating for the end-user.
我已经在使用剪贴板的应用程序中内置了一项功能。 企业需要一种让用户无缝捕获屏幕截图并上传的方法。
我与该公司合作开发它,我们的想法是用户只需按打印屏幕键并在我的应用程序中单击“上传”即可。
在后台运行的 Java Applet 将图像从剪贴板中拉出并向用户显示格式化的预览,然后用户添加文件名和描述并单击“保存”。
以这种方式使用剪贴板节省了用户必须捕获屏幕截图并将其保存在某处然后通过上传界面找到它的时间。 即使我们确实通过用户点击打印屏幕来捕获图像来走这条路,他们也已经覆盖了剪贴板上的所有内容。
使用剪贴板并不全是坏事,但我当然同意在 IDE 中使用它是绝对不行的。
I have built a piece of functionality into an App that uses the clipboard. Business was requesting a way for users to seamlessly capture a screen shot and upload it.
I worked with the business to develop it and what we came up with was a user simply hit the print screen key and clicked "upload" in my app.
The Java Applet running in the background pulled the image off the clipboard and displayed a formatted preview to the user, The user then added in a file name and description and clicked save.
Using the clipboard this way saved the user the time of having to capture the screen shot save it somewhere then find it through an upload interface. Even if we did go that route by the user hitting print screen to capture the image in the first place they are already overwriting whatever was on the clipboard in the first place.
Using the clipboard isn't all bad but I certainly agree using it in an IDE is a def no no.