Tk Drag & Drop Extension (tkdnd)

- Version 1.0b1 -

 

Description

tkdnd is an extension that adds native drag & drop capabilities to the tk toolkit. It can be used with any tk version equal or greater to 8.4 and currently only the UNIX (X-Windows) and Microsoft Windows operating systems are supported. Under unix the drag & drop protocol in use is the XDND protocol version 4 (also used by the QT toolkit, KDE & GNOME Desktops). Under Windows, the OLE drag & drop interfaces are used.

This extension is based on earlier work done by Gordon Chaffee (chaffee@bmrc.berkeley.edu), the author of the olednd extension that implemented OLE drag & drop capabilities for tk under Microsoft Windows. Olednd can be found here (zip file).

Please understand that this software is beta quality. If you have problems with it, please post a message on the comp.lang.tcl newsgroup (preferably with the word "tkdnd" in its title) and provide a detailed description (if possible) of your problem.

Note: The Microsoft Windows version can be used with any tk version greater or equal to 8.1. The unix version can also be used with any tk version greater or equal to 8.1 but this requires a core patch. Currently there are no patches available. Of course my recomendation is to upgrade to the most recent tcl/tk version, even if characterised as "beta"...

 

License Information

The author of tkdnd is George Petasis (petasis@iit.demokritos.gr). Laurent Riesterer was kind enough to revise the whole source code, to propose enchancments and to fix bugs. This code is based on a Microsoft Windows extension written by Gordon Chafee, although the whole package was reimplemented from scratch for both windows & unix. tkdnd contains an older version (0.3) of the shape extension, written by Donal K. Fellows. This extension can change the shape of any tk window, according to images, and is used in order to provide the "shape" command. Also uses the Motif Dnd package, written by Daniel Dardailler.

The license of tkdnd is the same license that covers tcl/tk. Practically, this means that you can do whatever you want with this code (even embed it in a commercial application). More details can be found here.

 

Download

Currently, the supported platforms are only Microsoft Windows & Unix. There is a single distribution that contains anything you need in order to build the extension under any of the supported platforms:

This distribution also contains a pre-compiled, stubs enabled, dynamic library for use with the standart tk distribution under the Microsoft Windows platform. This library was build using the Microsoft Visual C++ compiler (version 5.0)

 

Installation

If your platform is Microsoft Windows, then allong with the distribution there is a stubs enabled dynamic library (dll) that was built against tk8.4a1, with the use of VC++ 5.0. If you cannot use the provided binary, then you can always create the required library by using the VC++ project files located in the "win" directory of the tkDND distribution. In all other cases, you should create the library only from the files located in the directories "win" (*.cpp *.h) and "generic" (*.c *.h). You will need a C++ compiler for this.

If your platform is Unix you can use the "standard" procedure, as tkdnd is TEA compliant: configure-make.

Change your working director to the "unix" directory of the tkdnd distribution. Then run the "configure" script. This script will try to create suitable Makefiles for your opeating system. If you have problems running this script, try running the tcl script "tcl-conf".

Finally type "make". This will create a dynamic library that can be loaded from a tk interpreter (i.e. wish). You can additionally try the default demo applications, by typing "make tests".

If everything seems to work fine, you can install the extension by typing "make install". According to the parameters given to the configure script (especially --prefix), you may need super-user priviledges in order to complete this step. If the procedure for any reason fails, just copy the contents of the "lib" directory into a directory that tcl looks in order to load extensions.

 

Documentation

If the tkdnd extension has been properly installed, then can be loaded into a tk interpreter through a simple

package require tkdnd

tcl command. Doing so will register two new commands: "dnd" and "shape".

The "dnd" command can be used in order to register existing tk windows as drag sources or drop targets. The same command can be used in order to query drag & drop related information regarding registered widgets.

The "shape" command can be used in order to change the shape of tk windows based on transparency information contained in a specified images. The main purpose of this command is the creation of non-rectanular windows for use as cursors during a drag & drop operation. (Currently functional only under Unix.)

Unfortunately, there is not an extensive manual right now. You should look the demo tcl programs that exist in the demo directory. There is only a small man page which can be accessed here.

The tkdnd FAQ can be found here.

 

Known Bugs

Unix

Microsoft Windows

 

 

 


Petasis George, petasis@iit.demokritos.gr