README
1/* $XConsortium: README /main/3 1996/07/15 14:02:47 drk $ */
2README for the DNDDemo and simpledrop.
3
4 This directory contains the demos illustrating typical usage of
5 the drag and drop features. "simpledrop" is a minimalist demo,
6 helpful in showing how to get started in drag and drop without
7 too many special effects. "DNDDemo" uses most of the tricks
8 available in drag and drop to provide drag over and drag under
9 effects.
10
11simpledrop
12----------
13
14 The program simpledrop is a minimal drag and drop demonstration.
15 It displays a scale widget and a drawing area.
16
17 To use, startup the program, set the scale to a value and then
18 use BTransfer to drag the scale value. Drop the scale value into
19 the drawing area labelled "drop_here" and the number will appear
20 at the drop spot.
21
22 In addition, you can copy the numbers in the drawing area around.
23 Press BTransfer on one of the numbers and then drop somewhere else.
24
25DNDDemo
26-------
27
28 This demonstration program uses the Uniform Transfer Model in
29 Motif 2.0.
30
31 When the demo comes up, it does not have any valid drop sites. It
32 comes up with different color rectangles which act as drag sources
33 for dragging the colors around. You can create the drop sites as
34 follows:
35 Move the pointer into the drawing area (with white background).
36 Press MouseBtn1 and drag. You will see the rubberbanding effect.
37 Release MouseBtn1 after dragging some distance. A rectangle
38 will appear with one of its corners corresponding to the point
39 of MouseBtn1 press, and the diagonally opposite corner
40 corresponding to the point of MouseBtn1 release. The rectangle
41 comes up filled with black by default. You can create any number
42 of rectangles like this.
43
44 To initiate a drag, you move the pointer over to the drag source,
45 press BTransfer (which is MouseBtn2 by default), and start dragging.
46 Immediately, you will notice that the cursor changes to a painter's
47 palette in the same color as the color rectangle from which the
48 drag is initiated.
49
50 The rectanlges inside the drawing area that you created will act
51 as valid drop sites for colors. You can test this by, for example,
52 initiating the drag from the yellow color rectangle, dragging over
53 to one of the rectangles inside the drawing area, and releasing
54 BTransfer.
55
56 While you are dragging, you will notice several things.
57 When you are dragging over root window, the dragicon consists of
58 only the painter's palette. When you drag over parts of the
59 drawing area where there are no rectangles, you will notice that
60 the dragicon changes to include a "DO NOT ENTER!" sign on top of
61 the painter's palette; when you are dragging over any of the
62 rectangles inside the drawing area, you will see that the
63 "DO NOT ENTER!" sign gets replaced with a painter's brush.
64
65 To attempt a drop, you will release BTransfer. If you release
66 BTranfer with the pointer over any part of drawing area outside
67 of the rectangles, or anywhere on the root window, you will see
68 that the dragicon snaps back to the point of drag initiation,
69 and disappears. This is an indication that the drop you
70 attempted was a failure. On the other hand, if you release
71 BTransfer with the pointer over any of the rectangles inside
72 the drawing area, you will see that the dragicon melts into
73 the background and disappears; this indicates that the drop
74 you attempted was a success. Also, when the rectangle on which
75 the drop was attempted, gets filled with the color that was
76 being dragged around (yellow, in our example).
77
78 The rectangles inside the drawing area themselves act as drag
79 sources. You can initiate the drag with the pointer on any
80 rectangle, and you will notice that the cursor changes to
81 a rectangle (either of the same size or a smaller size depending
82 on X cursor size constraints). You can drag a rectangle from
83 one place and drop it onto a new place inside the drawing area.
84 The rectangle gets physically moved to the new position. If,
85 on the other hand, you want to copy the rectangle to a new
86 position, you can use the appropriate modifier key while dragging,
87 and/or at the time you attempt the drop (<Ctrl> is the modifier
88 key for copy in the current implementation). When you drag
89 a rectangle with no modifier key pressed or with <Shift>
90 pressed, you will notice that the solid rectangle from where
91 you initiated the drag gets replaced by a hollow rectangle with
92 dotted-line borders. It will continue to be this way, for
93 the duration of the drag or until you press the <Ctrl> key,
94 which will change the operation to Copy; at which time it will
95 regain its original solid form.
96
97 A couple of other things to note. Anytime during dragging, you
98 can cancel that drag by hitting the Cancel key. Also, during
99 dragging, anytime you hit the Help key, you will get a dialog
100 giving you some information about whether the drop will
101 succeed, what are the drop operations possible, etc.
102