summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorpetasisg@gmail.com <petasisg@gmail.com@f3661a36-4baa-549a-d6c7-40e0ffef350e>2014-09-21 13:30:49 (GMT)
committerpetasisg@gmail.com <petasisg@gmail.com@f3661a36-4baa-549a-d6c7-40e0ffef350e>2014-09-21 13:30:49 (GMT)
commit8ceb6511ca9f2b869977374614df5bb5d5686637 (patch)
tree5ebf0d0283cf009951dc1694b887182a72a61596 /demos
parent4dda192dd17aa0819651eaaf5fa59b2bc5dcb678 (diff)
downloadtkdnd-8ceb6511ca9f2b869977374614df5bb5d5686637.zip
tkdnd-8ceb6511ca9f2b869977374614df5bb5d5686637.tar.gz
tkdnd-8ceb6511ca9f2b869977374614df5bb5d5686637.tar.bz2
New demo
Diffstat (limited to 'demos')
-rw-r--r--demos/overlapping_targets.tcl29
1 files changed, 29 insertions, 0 deletions
diff --git a/demos/overlapping_targets.tcl b/demos/overlapping_targets.tcl
new file mode 100644
index 0000000..c893252
--- /dev/null
+++ b/demos/overlapping_targets.tcl
@@ -0,0 +1,29 @@
+cd [file dirname [file normalize [info script]]]
+source simple_source.tcl
+
+set background [. cget -background]
+
+proc my_drop {w type data action} {
+ puts "Data drop ($type): \"$data\""
+ $w configure -bg $::background
+ return $action
+};# my_drop
+
+##
+## Drop targets
+##
+
+set parent {}
+foreach type {DND_HTML DND_Text DND_Files} bg {orange orange orange} {
+ set w [labelframe $parent.drop_target$type -labelanchor n -bg $::background \
+ -text " Drop Target ($type) " -width 80 -height 40]
+ pack $w -fill x -padx 20 -pady 20
+ tkdnd::drop_target register $w $type
+ bind $w <<DropEnter>> {%W configure -bg green}
+ bind $w <<DropLeave>> {%W configure -bg $::background}
+ bind $w <<Drop>> [list my_drop %W %CPT %D %A]
+ # bind $w <<DropPosition>> {puts "Common types: %CTT"; return copy}
+ set w [frame $w.frame -bg $bg -width 60 -height 20]
+ pack $w -fill x -padx 20 -pady 20
+ set parent $w
+}