Levure Dataview Question

Trevor DeVore lists at mangomultimedia.com
Mon Apr 1 10:37:45 EDT 2019

On Fri, Mar 29, 2019 at 1:41 PM David Bovill via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Is there built in support for drag- reordering of rows?

There are some APIs for helping with drag reordering. They are not
currently documented though.

The following code will create a drag image from one of the rows and turn
on tracking so that a horizontal bar appears within the DataView where the
drop will occur.

on dragStart
  set the dvDragImageRow of me to item 1 of the dvHilitedRows of me
  set the dvTrackDragReorder[the dvHilitedRows of me] of me to true
  set the dragData["private"] to the dvHilitedRows of me # dragdata has to
be set to something.
end dragStart

The DataView will then send a `DragReorderRows` message when the drop
occurs. Since the DataView doesn't know anything about your data source it
is up to the developer to update the data source and refresh the view.

The `DragReorderRows` handler looks like this:

command DragReorderRows pRowsBeingDragged, pMoveToRow, pDroppedAfterRow
  put "pRowsBeingDragged:" && pRowsBeingDragged & cr & \
        "pMoveToRow:" && pMoveToRow & cr & \
        "pDroppedAfterRow:" && pDroppedAfterRow
end DragReorderRows

Trevor DeVore

More information about the Use-livecode mailing list