[ANN]: TkDND 2.0 alpha...
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

[ANN]: TkDND 2.0 alpha...

From: Georgios Petasis <petasis@iit.demokritos.gr>
Date: Sat Apr 01 2006 - 14:31:47 CEST

Although not an official announcement yet (as my web server is down due
to a scheduled power shortage), I am posting some details about the
forthcoming release of the TkDND version 2.0 series.

1) TkDND v 2.0 wil lbe incompatible with 1.x versions. Perhaps
a compatibility layer will be added to support the most common
use cases of the 1.x series.

2) TkDND won't support user-defined drag and drop format, as
1.x supported. I think that this was a feature never used by somebody.

3) The current implementation, support only drops from other applications
to Tk windows. Of course, full drag support is planned.

4) Motif drag and drop handling won't be supported.

Now, what the new API look like:

Drop target widgets:
--------------------------------

A drop target widget can be defined as:

tkdnd::drop_target register .drop_target <type-list>

<type-list> can contain cross-platform types, like "DND_Text" and
"DND_Files",
or platform-dependent types like CF_HDROP or text/files.
A new feature is that types can also have wildcards, like in "string match".
For example, the type "*" will accept all types!

Since a widget is registered as a drop target, 4 events can be delivered
to the widget during drop operations: <<DropEnter>>,
<<DropPosition>>, <<DropLeave>> and <<Drop(:*)?>>.
You can register a widget to receive these events, by using bind:

set cmd {handle_event %E %W %X %Y %ST %TT %A %a %CST %CTT %T %t %B %D}
bind .drop_target <<DropEnter>> $cmd
bind .drop_target <<DropPosition>> $cmd
bind .drop_target <<DropLeave>> $cmd

The <<Drop>> event, can be more complex: a widget can register a generic
<<Drop>> event that will be called when any drop event occurs. But it can
also register a more "specific" drop event, associated with a type:

bind .drop_target <<Drop>> $cmd
bind .drop_target <<Drop:DND_Files>> $cmd

In such a case, if a file is dropped on the widget, the event
<<Drop:DND_Files>> will be called. For all other drops
(like texts), the "generic" <<Drop>> will be called.

All event bindings, if defined, are expected to return the drop
action (one of copy, move, link, ask, private & refuse_drop).
Also, bindings can have various pieces of information, like
Event (%E) Widget (%W) X (%X) Y (%Y) Source_Types (%ST)
Target_Types (%TT) Source_Actions (%A) Action (%a)
Common_Source_Types (%CST)
Common_Target_Types (%CTT)
Types (%T) Drop_Type (%t)
Pressed_Keys/Buttons (%B) and Data (%D)

How does this new interface sounds?

George

(The new version will be available as soon as my server will be up again,
which is expected to happen by tonight.)
Received on Sun Apr 30 02:56:00 2006