Seems a lot clearer now! Thank you, Jacque.

Jim Bufalini wrote:
You're just TOO good at explaining things, Jacque! :-)

Jacque wrote:

Let's try something simple. Suppose you have a card with lots of
buttons
that the user can move around; maybe your script uses the "grab"
command
to let them drag the butons. Now you want a way to reset the card to
its
native state that puts all the buttons back to their original
positions.

Buttons have a "loc" property, but that only stores the current
position
of the button at this moment, and the engine will update that value
every time the button moves. There isn't any native property that tells
you where the button started from, but we can make a custom property
that does that. We'll call it the "startLoc" and each moveable button
will need to have that property assigned to it. Before the user has a
chance to drag anything (maybe during development, or during
preopencard) you run a little handler that sets that property for each
button:

on setBtnLocs
   repeat with x = 1 to the number of btns
     set the startLoc of btn x to the loc of btn x
   end repeat
end setBtnLocs

Now each button has a custom property called "startLoc", and the value
of the property for each button is it's current position.

Now you're ready to grab the buttons and move them all around till
nothing is in the right place any more. Then you can click a "Reset"
button which puts them all back with this simple script:

  on mouseUp
   repeat with x = 1 to the number of btns
    set the loc of btn x to the startLoc of btn x
   end repeat
end mouseUp

Your custom property "startLoc" acts just like any other property. The
only difference is that the engine doesn't create or update it, you do.

I can think of several other ways to store each button's start
position,
but none of them are this simple, and none of them tie the correct
value
to each button individually the way having a custom property does. The
startLoc of each button becomes an integral attribute of the button
just
like its color or its name, and is the only way to accomplish this
example with any degree of efficiency.

--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to