Getting Contents of Multiple fields in order (Left-to-Right&Down)

Peter Brigham MD pmbrig at
Sun Jan 30 10:27:03 EST 2011

On Jan 29, 2011, at 9:28 PM, John Patten wrote:

> Thanks for looking into this with me!  The way you (Jim) appear to  
> take what I did and turn it around in a fraction of the lines is  
> amazing! Someday I want to be able to do that :-)
> Jacqueline is correct. The fields make up a mixed up paragraph. I  
> have it working where it lines up the mixed up fields nicely across  
> and down the window. The user is to put the fields back in order. If  
> one of the fields is a pixel lower on a line, or when the user has  
> to start another line of fields below the first, there is a problem.  
> I like your idea Jacqueline about the drop down fields but I'm  
> afraid not being able to see all parts of the paragraph will make it  
> too challenging at a beginning level.
> I thought I could make each row of fields on the window a separate  
> group. This could be done when the stack creates the fields for each  
> line. However, that would mean that I would only have mixed up  
> content for each line going across, and I couldn't make the user  
> drag fields between lines. I want more mixed up flexibility...
> Maybe I could have the fields snap to alignment some how when the  
> user checks their answer and before the sort...but that still would  
> not eliminate the issue with the subsequent lines of fields and  
> their order over all...
> LiveCode doesn't do character recognition does it (OCR)? I could do  
> a screen capture, covert the pict to text and then check its  
> content ;-) ...
> Hmmm? What if the user drags the fields over a target...the target  
> could "suck the text" out of the field and spit it out in another  
> field. (This essentially would be eliminating the user to type out  
> their words on a keyboard.) However, how would I handle the user  
> wanting to change their order? Could the text chunks they drag into  
> the target be "special chunks" that act as quasi buttons that when  
> clicked on by the users recreates that specific chunk text and  
> deletes itself from the answer field? The user could still drag  
> their fields around on the screen to order them the way they want,  
> and then just drag them into the target one at a time. What do you  
> think? This seem doable?

Sure. Create a number of small text fields with behavior set to a  
behavior button and a target button. In the behavior button script set  
up mousedown and mousemove handlers to handle dragging (see the  
archives for how to do this), and in the mousemove handler include a  
'if the mouseloc is within the rect of btn "target then eatme" '. Then  
the on eatme handler in the card script takes the text of the target  
field and appends it to the display field and deletes the target  
field. In the display field, put a mouseup handler that hilites the  
clicked line briefly for user feedback then creates a new small field,  
sets it behavior to the behavior button, loads it with the line text,  
then deletes the clicked line.

If that's what you want to do. Not sure why you prefer this to just  
dragging the lines around to reorder them in the display field. I  
guess it's a game that you have in mind?

-- Peter

Peter M. Brigham
pmbrig at

More information about the Use-livecode mailing list