summaryrefslogtreecommitdiff
path: root/tix/demos/samples/DragDrop.tcl
blob: 1feb61fa2717b6bd0cbe3b38ff91f6bc14061376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.

# This file demonstrates the Drag+Drop features in Tix. Drag+Drop is still
# experimental in Tix. Please don't use. For your eyes only.
#
#
proc RunSample {w} {

    text $w.d -height 5
    $w.d insert end {Quick and dirty example:
click on any node on on the directory lists and drag. You can see the
cursor change its shape. The "dropsite" of the directory lists will be
highlighted when you drag the cursor accorss the directory nodes.
Nothing will happen when you drop. }

    pack $w.d -padx 10 -pady 5

    tixDirList $w.d1; pack $w.d1 -fill both -padx 10 -pady 5 \
	-side left
    tixDirList $w.d2; pack $w.d2 -fill both -padx 10 -pady 5 \
	-side left

    button $w.b -text "Close" -command "destroy $w"
    pack $w.b -side left -anchor c -expand yes

    $w.d1 subwidget hlist config -selectmode dragdrop
    $w.d2 subwidget hlist config -selectmode dragdrop
}

# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
    wm withdraw .
    set w .demo
    toplevel $w
    RunSample $w
    bind $w <Destroy> "exit"
}