Drag from-within-to list fields

Wilhelm Sanke sanke at hrz.uni-kassel.de
Thu Feb 10 13:45:25 CST 2005


I have assembled six stacks - as substacks of a stack "dragmenu" - that
implement and illustrate various forms of drag behavior to be used with 
list fields.

The stack can be directly downloaded from here

<http://www.sanke.org/Software/DragWithListfields.zip>

or from page "Tools and Samples for Development" of 
<www.sanke.org/MetaMedia>

The scripts can most certainly - as usual - be improved, refined, and 
extended, but they may at least show directions how to tackle some 
problems coming up when you wish to visibly (not just with a drag 
cursor) drag between or inside controls whose locktext is set to true.

1. There is one stack for dragging text lines "between" list fields

Any number of list fields can be used with the interaction of the 
(identical) scripts of the list fields and the card. If one of the lines 
is clicked, a semi-transparent button appears that can be dragged to 
other list fields. Releasing the mousebutton places the dragged line 
inside the lines of the chosen list field. If the line is dragged to the 
empty space below the lines in another list field, it will be added 
below the last line.

Releasing the mousebutton in the same field where the dragging started - 
or somewhere else in the stack window - simply lets the dragged line 
disappear.

The transparency of the drag-button is achieved by setting the ink to 
"blend" on MacOS and to "scrOrReverse" on Windows together with an 
appropriate backcolor..

2. Four variants of dragging "within" list fields:

a) In this preview card of a slideshow stack dragging is used to arrange 
the sequence of images for the slideshow (The slideshow part is not 
added to this sample stack, but can be downloaded elsewhere from my 
website).

The drag-procedure here does not make use of snapshot-lines, buttons, or 
graphics, but simply "drags" the textline itself. The script part of the 
list field responsible for the dragging comprises a total of 27 script 
lines.

If you experiment with this stack, be sure that stack "datachoice" - a 
customised "answer dialog" - is available, which is also an example of 
how "dialogdata" can be used with modal stacks. "Datachoice" is 
contained as a parallel substack of main stack "dragmenu", because as a 
substack it cannot be part of  substack "slideshow" in this case.

b) In stack 2.b, again, a transparent button with the ink set to "blend" 
or "scrOrReverse" - as mentioned above - is used.

The line number to place the dragged word is calculated by using item 2 
of the mouseloc and the textheight of the field.

c) Following the recent discussion on this list, I have taken the 
liberty to slightly modify Scott Rossi's "GetinLine" stack in order to 
obviate the flashing of the screen and the necessity of a delay of 250 
millisecs for the drag start when a snapshot of the line-to-be-dragged 
is used.

I have substituted the snapshot image with a button and eliminated the 
delay, otherwise the script was left mainly intact.

d) Another modification of "GetinLine", this time using a transparent 
graphic instead of the snapshot image and also removing graphic 
"dragpointer", which may not be needed with this solution. However, that 
may be a matter of "visual" taste.

3. Producing textlines in a list field by clicking on a text field and 
dragging from the list field to the text field to "fill the created blanks"

This is a simplified version of a card from a rather old stack using 
different formats of so-called "cloze-procedure" exercises - a popular 
format in language teaching -, originally programmed in Hypercard. 
Traces of Hypercard can still be detected in the script.

With the SHIFT-key down and click on words in the text field "dotted" 
blanks are created in the text and the selected words appear - sorted 
alphabetically - in the list field. This feature belongs to the 
"teacher" module of the "cloze" exercise.

The words can then be dragged from the list field to the dotted blanks - 
the button-version for dragging is used. If a dragged word fits, it will 
be inserted at the place of the blank, if not, it will be moved back to 
the list field.

The "create blanks" and "drag-from-list field" features are implemented 
by the interacting scripts of the text field, the list field, the 
dragged button, and the card script; additionally a back-up text field 
is needed (field "Kontrolle") where a duplicate of the full text is 
stored.--

As said above, the scripts could and possibly need to be improved and 
refined; especially, I have not implemented "scrolling-while-dragging" 
in my examples. Such a feature could be added, but presumably with 
solutions different from those used in the stacks of Scott Rossi and Jan 
Schenkel. However, the basic functionality is there: You just have to 
scroll a "full" list field between dragging.

Regards,

Wilhelm Sanke





More information about the use-livecode mailing list