Purpose: discuss unique features and special concerns relating to copy and paste functionality within [Tk]. Q1. How do I get copy and paste within a Tk application? A1. Copy and paste should, in general, work out of the box. Q2. What about copy and paste between major versions like 7.6 or 8.0 and 8.1 and newer? Does copy and paste work between non-[Unicode] Tk and Unicode Tk? A2. Yes. It uses UTF8_STRING on unix and the standard APIs on Windows. Q3. Anything special that needs to be done about copy and paste between Tk 8.1 and newer and non-Tk applications? 3. No. Q4. [...] between [Java] applications and Tk 8.1 and newer applications? A4. Same as above. Q5. Does this work on Windows, MacOS, etc? A5. OS X has some unicode display issues as of 8.4.9, but everywhere else is OK. Q6. On X, there are several kinds of selection - clipboard, cutbuffers, etc. What does Tk's copy and paste use, and are there ways to access the other buffers? A6. Using the [clipboard] and [selection] commands, it uses the PRIMARY selection, but you can access others via [selection]. Q7. Has anyone done any interesting development relating to Tk's copy and paste functionality? A7. These have potential interest * [aclip] * [SuperClipboard] * [tkpgp] Q8. Are other people annoyed that they can't select (copy) text from a label widget? I often misuse an entry widget (disabled) just to get copy capability. ([EKB] - no, I don't expect to be able to copy from a label. If I use a disabled entry widget to allow a copy, I make sure it's sunken or otherwise distinguished from a label.) ''[MG] There are some comments/pieces of code on the [label] page about how to achieve this''. [Setok]: I believe one should be able to copy all text from the screen, whatever the widget. Yes, it is frustrating that labels act like that. A8 [wdb] I happen to have a solution for copying label entries to clipboard: % bind Label <3> {::Lambda::Function::62 %W %X %Y} % sourceCode ::Lambda::Function::62 proc ::Lambda::Function::62 {w x y} { focus -force $w tk_popup .contextMenuLabelCopy $x $y } % .contextMenuLabelCopy entrycget 0 -command clipboard clear clipboard append [[focus] cget -text] % .contextMenuLabelCopy entrycget 0 -label Kopieren From now on, all labels can copy. Instead of cryptic ::Lambda::Function::62, choose a name which tells more about its function. Simple. Q9. When I copy from a Tcl/Tk app on OS X, then quit that app, the text I copied doesn't appear in the system-wide paste buffer. I need to switch focus to something else while the Tk app is still running for cross-app copy/paste to work as expected. I'm using Tcl/Tk 8.10 on Leopard, though I had the same problem with 8.7 on Tiger. Any way around this? A9. [SLB]: I cannot answer specifically for OS X but a similar problem occurs on Windows. I did investigate that and found that Windows provides two methods for storing information in the clipboard: you can copy the textinto the clipboard or you can store in the clipboard a reference to the application holding the text. The latter is more efficient when the amount of text is very large but means the information is lost when the application terminates. This is the only form of copy offered by Tk. Resolving it would require a TIP to extend clipboard support in Tk. ---- [[fill in more questions as needed]] ---- !!!!!! %| [Category Concept] | [Category Discussion] | [Category GUI] |% !!!!!!