Here's how to drag-reorder lines in a list field

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Here's how to drag-reorder lines in a list field

Post by bogs » Mon Feb 01, 2021 12:16 pm

dalkin wrote:
Mon Feb 01, 2021 5:54 am
None of the terms eg. 'lastPosition' are in the dictionary so I don't have the knowledge to sort it.
Not sure exactly where you are getting hung up, but I'll give a shot at giving you an overview of how this code is supposed to work, starting with the term you listed.

lastPosition in this script is being declared as a local variable at the top of the script, along with lineText. Variables are declared by the programmer, they will not be found in the dictionary ;)

The 'mouseDown' handler is supplying the initial values to the two local variables.

mouseMove is a message that fires as long as the mouse is moving. during that period, it looks at the 2 variables, and updates the lines in the field by adding and deleting carriage returns (cr).

To see what values he is taking and putting into the variables, open the message box, move the cursor over a field of text, and type in mouseLine. You should see something like this -

Image

The code in the mouseMove handler in the second if / then loop is saying that (in the case of the picture) if word 2 (the number 5) equals the number of lines in the field, and there is no carriage return, then add one (so the line can continue being dragged down).

Hopefully, that was of some help to you.
Image

dalkin
Posts: 183
Joined: Wed Jul 04, 2007 2:32 am
Contact:

Re: Here's how to drag-reorder lines in a list field

Post by dalkin » Tue Feb 02, 2021 5:42 am

Thanks so much! And now to figure it out!
The underlying purpose of Al is to allow wealth to access skill
while removing from the skilled the ability to access wealth.

Post Reply