Copy, Paste to Windows Clipboard 
Author Message
 Copy, Paste to Windows Clipboard

Is there a way of getting Tk to communicate with the Windows clipboard?
I read the online docco, and it seems to be all based on the X-windows
model of copy and paste. Can it be adapted to work with Windows? Or does
it only work internally between Tk widgets?

Any pointers or suggestions appreciated.


Thanks,

Ben Stanley




Fri, 05 Feb 1999 03:00:00 GMT  
 Copy, Paste to Windows Clipboard


Quote:
>Is there a way of getting Tk to communicate with the Windows clipboard?

The Tk widgets will work with Win95.  I have succeeded in doing the C/C/P
from text and entry widgets to things like the Notepad and back.

--
     Jeffrey Hobbs                       office: 541.683.7891

              URL: http://www.cs.uoregon.edu/~jhobbs/



Sat, 06 Feb 1999 03:00:00 GMT  
 Copy, Paste to Windows Clipboard

|> Is there a way of getting Tk to communicate with the Windows clipboard?
|> I read the online docco, and it seems to be all based on the X-windows
|> model of copy and paste. Can it be adapted to work with Windows? Or does
|> it only work internally between Tk widgets?
|>

I have exactly the same question. I found nothing in the FAQ (tcl/Tk on Windows)
but I saw, that the "selection" command do not work between different
Tk applications on WinNT.

Is there any patch available ?

Or is it an installation problem ?

Thanks,

Lothar Linhard.



Tue, 09 Feb 1999 03:00:00 GMT  
 Copy, Paste to Windows Clipboard

Quote:


> (Ben Stanley) writes:
> |> Is there a way of getting Tk to communicate
> with the Windows clipboard?
> I have exactly the same question. I found nothing in the
> FAQ (tcl/Tk on Windows)
> but I saw, that the "selection" command do not work
> between different
> Tk applications on WinNT.

 The word "selection" does not appear in the Tcl/Tk On
Windows FAQ (at least not until I update it. :-). I
think you may be confusing "send" with "selection".

The selection functions do work between Windows apps and Tcl/Tk
scripts. Try the following: select some text in MS Word,
Write or any other Windows app. Copy the data to the clipboard
(inside the app). Then, enter the following at your wish prompt:

 set clip [selection get -selection CLIPBOARD ]

The variable clip should now hold the data from the clipboard.

The parts that may be troublesome are that:

a.) Unix apps tend to use an active copy and paste with
the PRIMARY selection.

b.) Windows apps tend to use a passive copy and paste,
placing the data in the clipboard as an intermediary
stopping point between the applications.

c.) Motif applications on Unix do use the CLIPBOARD selection.
Decoding the Motif clipboard is a left as an exercise for
the reader.

d.) The X selection mechanism handles a lot more than text,
which introduces some interesting complexity.

All in all, Tk does pretty good with handling selections
on multiple operating systems.

The part that may be confusing you is that wish, by default,
doesn't use the Windows bindings for cut, copy and paste
(Ctrl-X, C and P, respectively, at least on English systems).

From the aforementioned FAQ, here's some relevant information:

   D-5: Cut, Copy and Paste in the Tcl Console Window

   The Tcl Console window uses the default bindings for the Tcl text
   widget, which is not compatible with the Windows standard of

     * Ctrl-x: cut
     * Ctrl-c: copy
     * Ctrl-v: paste

   Instead, the Tcl Console window (by default) uses the following
   bindings:
     * Ctrl-x: deletes selected text
     * Ctrl-w: cut
     * Alt-w: copy
     * Ctrl-y: paste

For more information on the Tcl/Tk clipboard and Windows,
see the section on Cut, Copy and Paste with the Text
Widget starting on page 169 in the book Graphical Applications
with Tcl and Tk. My Web page (the URL appears below) has
more information on this book.

I hope this helps,
-Eric

--
Eric F. Johnson     URL:
http://ourworld.compuserve.com/homepages/efjohnson/
CAMAX Manufacturing Tech., Inc.
7851 Metro Parkway           phone: +1 612 854 5300     fax: +1 612 854
6644



Tue, 09 Feb 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. X clipboard - Cut Copy Paste?

2. Windows cut/copy/paste keys

3. copy and paste ruby code under windows

4. Dynamic copy/paste using DDE with Python on Windows

5. copy/paste(^c/^v)on selection different linux/windows

6. Copying and pasting from Tk Windows to other applications mangles double-byte text

7. Copy Text to Windows-Clipboard?

8. How to copy LABVIEW array or cluster data to the Windows clipboard

9. copy image to windows clipboard?

10. How to copy a canvas (or window) to Windows Clipboard

11. copying text to Windows clipboard from Harlequin Lispworks?

12. Paste to clipboard with toolboxes, help!

 

 
Powered by phpBB® Forum Software