Drag and drop within a list field
paul at researchware.com
Fri Jul 16 11:06:48 EDT 2021
I have a scrolling list field that has contents like:
the field has a custom property with the contents and a "type" for each
name, so the data in the custom property look like:
The type for each line can be either 'code' or 'folder'. I am trying to
craft code for the field script that supports dragging a line that is a
'code' or 'folder' onto a line that is a 'folder'. You can not drag a
'code' or 'folder' onto a 'code' line.
I have a dragStart, dragMove and dragEnd handlers, but something is off
with my code with regard to autoscrolling the field. (the actual list of
names is much longer than my example above). When dragging near the
bottom of the field, I try to detect if I am within a textHeight of the
bottom of the field (or top if scrolling up) and and scroll the field,
but it is very jerky. The user must keep moving the mouse around
slightly so that continual dragMove messages are sent and I have other
problems with highlighting the destination line when you are over a
'folder' that you can drop on.
Does anyone have some "best practice" code for this capability that they
would be willing to share? I admit coding drag and drop operations in LC
is one of the areas I am least familiar with.
More information about the use-livecode