Perl/Tk supports two kinds of
selection. They are named after the atoms that identify them:
selection buffers are capable of handling arbitrary data, but they
default to simple ASCII text strings. Handling other data is beyond
the scope of this book, thus we confine the discussion to strings.
When making a selection, standard Perl/Tk widgets—such as Text
PRIMARY and highlight the
selection. The widgets copy the selection to
CLIPBOARD as well. This means that pasting text in
Tk works in either of two ways:
Using the middle button, which copies the
Using the keyboard character Control-v, which copies the
Although we don’t talk about virtual
events until Chapter 15, participating widgets
<<Paste>> virtual events to class
methods that manipulate the
The MainWindow generates virtual
<<Paste>> events when it sees the
characters Control-c, Control-x, and Control-v, respectively.
Applications differ as to which selection mechanism they use. The
tendency these days is to use the
v. What differs is the lead-in character. It may
be Control, Alt, or, on a Macintosh, the Apple key. Venerable Unix
applications tend to use
PRIMARY, where you copy
with button 1 and paste with button 2. Your mileage may vary.
The following methods ...