views:

305

answers:

6

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)

+4  A: 

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.

Andrew Moore
Or to let users copy/paste information in a particular format. But yes, other than that, an app should leave the clipboard alone.
Sean Nyman
A: 

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.

Daok
This is not as simple as you think...data may be offered through the clipboard in multiple formats, and you would have to store each one to be sure that you could satisfy all the same requests. That's even assuming you know enough about all of the formats to cache them...
ReWrite
+1  A: 

An app should never change anything on the clipboard without the user initiating that action. My .02 anyway.

Moose
+1  A: 

Bonus votes to whoever puts himself in place of the feature's programmer, and provides some reasoning for this being done on purpose

Using clipboard for application communication

ChrisW
A: 

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.

Knife-Action-Jesus
This has an explicit user-initiated action (print screen) which writes to the clipboard independently of your application. Nothing wrong with that. Quite different to what eran is complaining about.
Oddthinking
+1  A: 

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

Chris Thornton