copying objects

Steve Messimer steve at messimercomputing.com
Sat Mar 23 10:03:01 EST 2002


Hi,

I'm working on a plug-in that seeks to create objects in another stack. I
have been successful to a degree but several issues have arisen that raise
some questions about the best way to accomplish this.

Basically I am having the user make changes to a grp and a button that
controls the visible property of the group so that once it is created the
button shows and hides the group (among other things).  The scripting of the
objects themselves has been accomplished the question is "What is the best
way to create them in the target stack".

here are my options as I see it.

I can go to the topStack and create a new button assign it the desired
properties and script w/o much problem.  The group becomes a much more
complex issue because it may contain 20 or more sub objects.  This would
require a lot of coding.

The other option is to have the user make changes to the Objects in the plug
in then simply copy the Objects to the new stack.  At the end of the script
use custom properties to return the plug-in objects to some predefined
default state.  

I have been using the following scheme to try to do this without a lot of
luck.


put the name of btn id "1281" into btnName
copy button btnName
push card
open stack targetStack -- this variable was initialized earlier
go to card id targetCard -- this variable was initialized earlier
paste btn btnName -- I'll deal w the loc & rect of the object later
pop card

put the name of grp id "1498" into grpName
copy grp grpName
push card
open stack targetStack -- this variable was initialized earlier
go to card id targetCard -- this variable was initialized earlier
paste grp grpName --I'll deal w the loc & rect of the object later
pop card

-- reset btns properties to defaults so they can be used to make other new
objects

Is it necessary to go to a particular card in the target stack? Presumably,
the user will already be on the desired card when the plug-in scripts are
executed.

Is it possible to copy the Objects one right after the other, like so?

copy btn btnName
copy group grpName
push card
open stack targetStack
go to card id targetCard
paste btn btnName
paste grp grpName 
pop card

TopStack Question: Does the topStack designate the mainStack or the stack
that is in the currently active window?

Thanks

Steve

Stephen Messimer
Messimer Computing




More information about the use-livecode mailing list