Drag line in list to new row
This is the code in the $event method of MyList which I use to rearrange line positions within the list using drag and drop. :-
DroppedOnSameLine Boolean False
LineNumber Number (Long Integer)
LineRef Item reference
Ensure the following properties are set :-
Do $cwind.$objs.MyList .$dropbetweenlines.$assign(kTrue)
Code behind list :-
Quit event handler (Discard event) ;; Only drag and drop to re-order fields is allowed.
; Rearrange the order of the lines in the list :-
Calculate LineNumber as mouseover(kMLine)
Do pDragValue.$first(kTrue) ;; Sets the first selected line to be current.
Do pDragValue.$addbefore(LineNumber) Returns LineRef ;; Adds an empty line before the dropped line number.
Calculate pDragValue.$line as pDragValue.$line+1
Do LineRef.$assignrow(pDragValue) ;; Assign the data form the current row to the new empty line
Calculate LineNumber as LineNumber+1
Do pDragValue.$next(pDragValue.$line,kTrue) ;; Make next selected line current
Calculate DroppedOnSameLine as kTrue
Break to end of loop
Do pDragValue.$remove(LineRef) ;; delete the inserted blank line
Do pDragValue.$remove(kListDeleteSelected) ;; delete the original data
Do $cinst.$redraw() ;; redraw list
Hope that helps
From: omnisdev-en [mailto:firstname.lastname@example.org] On Behalf Of Martin Luce
Sent: 31 August 2017 11:14
To: Omnis List <email@example.com>
Subject: Drag line in list to new row
I am trying to reorder a list by by dragging a line from say line 5 to drop it into the position say between lines 2 and 3 in the same list, so that the dragged line becomes #L=3. Not getting much success. I can drag the line but it won’t drop into position. I am using 4.2.
If anyone could show me the event method for the list and perhaps a screen shot of the property action tab plus anything else I need to make it work, I would be very grateful.
Manage your list subscriptions at lists.omnis-dev.com