Chapter 9. Using the Clipboard

The clipboard is something users generally take for granted with the applications they use (because every successful operating system and every successful application has one), but take a step back and reflect on it and you will realize how essential it really is. Imagine the software you use from day to day and try to picture how it would be different if you could not use copy and paste. Would you still use a Web browser, an e-mail client, or an instant messaging application if you could not copy anything from or paste anything into that application? What about a text editor or an image editor?

Most users would not accept an application that only offered save and import functionality if there was a similar application available that allowed copy and paste. On the surface, copy-and-paste is just a time-saving mechanism, but it is so effective that most users depend on it heavily.

Because the clipboard is consistent across operating systems and applications, it is a glaring omission when applications fail to have a copy-and-paste feature. Effective use of the clipboard can be a great enhancement to your application.

Choosing a Clipboard Format

Whenever an application adds data to the clipboard, it specifies the format for that data so that other applications can use it. It is also possible to add the same piece of data in more than one format, to give other applications a choice.

For example, if your application displays formatted text, you could choose ...

Get Adobe® AIR™ Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.