Place vs copy

Mark Wieder mwieder at ahsoftware.net
Sat Jul 23 19:25:17 EDT 2005


Jacque-

Saturday, July 23, 2005, 11:12:51 AM, you wrote:

JLG> Mark Wieder wrote:
>> All-
>> 
>> I'm trying to apply some optimization techniques learned from the
>> online scripting conferences. And running into snags.
>> 
>> "Placing" a group instead of copying and pasting it seems to turn its
>> background behavior on. Is there something similar for non-background
>> groups? Here's what I'm faced with - I'm currently pasting between
>> some 100 to 300 copies of a single group onto a card. Is there a
>> better way to do this than copy-once-paste-many?
>> 

JLG> You should definitely be placing the group onto the cards in this case.
JLG> Having 300 copies of a group will not only inflate the stack size, but
JLG> you'd have to make any changes to it 300 times if you want to alter
JLG> something.

JLG> Setting the backgroundbehavior of a group which has been placed on many
JLG> cards makes sense (it changes the message path, which is usually what
JLG> you want with a shared group.) But if you don't want group messages to
JLG> happen after the card messages, then just turn off backgroundBehavior
JLG> after you are done placing the group on all the cards.

JLG> Why wouldn't you want backgroundBehavior in this case? Does your stack
JLG> create new cards on the fly where you don't want the group placed?

Well, here's what I'm doing:

I've got a template group which contains a few fields. I need to place
many copies of this group onto a card and I then set the name of the
newly created copy to a unique indicator. I'm not using multiple cards
here except that I've now got the template group on a "templates" card
so that I can place it. Otherwise all the copies to onto a single
card. Think of a crossword grid where each square is a separate group.

The first problem I run into is that if I "place" the template group
onto the card and then rename it, the template group is also renamed
(and made into a background group). Therefore the second attempt to
place another copy of the template fails because the original can't be
found. I don't really care whether backgroundBehavior is turned on or
off on the copy, but making the original a background group prevents
me from placing other copies.

I think making multiple copies of the group and pasting them onto the
card is what I'm stuck with here. My guess is that "place" makes an
alias of the original group and pastes it into the destination,
enabling backgroundBehavior along the way.

-- 
-Mark Wieder
 mwieder at ahsoftware.net




More information about the use-livecode mailing list