#!/bin/sh
# the next line restarts using wish \
exec wish "$0" "$@"

set data "Hello, I'm TkDND!!"
set type "Text"
set number "10"

label .l -bd 2 -relief groove -text "Drag Data"
pack .l
bind .l <Drag> {
if {$type == "Number"} {
  dnd_setdata $number $data
} else {
  dnd_setdata $type $data
}
dnd_handledrag
}

entry .e -bd 2 -relief sunken -textvariable data
pack .e

frame .f
radiobutton .f.r1 -value "RawData" -variable type -text "RawData"
radiobutton .f.r2 -value "File"    -variable type -text "File"
radiobutton .f.r3 -value "Files"   -variable type -text "Files"
radiobutton .f.r4 -value "Text"    -variable type -text "Text"
radiobutton .f.r5 -value "Dir"     -variable type -text "Dir"
radiobutton .f.r6 -value "Link"    -variable type -text "Link"
radiobutton .f.r7 -value "Exe"     -variable type -text "Exe"
radiobutton .f.r8 -value "URL"     -variable type -text "URL"
radiobutton .f.r9 -value "MIME"    -variable type -text "MIME"
frame .f.n
radiobutton .f.n.r -value "Number" -variable type
entry .f.n.e -bd 2 -relief sunken -textvariable number
pack .f.n.r .f.n.e -side left

pack .f.r1 .f.r2 .f.r3 .f.r4 .f.r5 .f.r6 .f.r7 .f.r8 .f.r9 .f.n -anchor w
pack .f -anchor c
