Getting Contents of Multiple fields in order (Left-to-Right&Down)
J. Landman Gay
jacque at hyperactivesw.com
Sun Jan 30 13:35:50 EST 2011
On 1/29/11 8:28 PM, John Patten wrote:
> 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 didn't exactly mean drop-down fields, I meant more what you describe here:
> 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
That's pretty much what I meant, only I'd snap the whole draggable field
to the desired location. I do this in my card games, where the user
needs to drag an image to a stack of playing cards; when they drop the
image, it snaps to the location of the "card stack". Dragging a field
would be an identical process.
The basic idea: Place four fields where the "sentence" should go. Turn
on the showborder for the fields (so the user can see the target areas)
and set traversalOn to false. These are the "target" regions.
When the user drags and then drops a field, check to see if it
intersects any of the target regions (you can use the "intersect"
function.) If so, set the location of the dragged field to the location
of the target field. That "snaps" it into place (and if you add a sound
effect, it's very satisfying.) Now that the visual part is complete, put
the text of the dragged field into the target field so you can read it
later. The dragged field is still covering the target region so it
doesn't matter what the text underneath looks like or how it's formatted.
When it's time to read the sentence, you already know the order of the
target fields, so you just collect their text and then empty out the
targets, ready for the next time.
My Klondike game is on RevOnline if you want to look, though there's
probably more in there than is worth plowing through just for this
example. The whole game uses this "snap" method, but it is easiest to
see when you drop cards onto the top piles that build from aces up.
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the Use-livecode