Page 1 of 1
cloning group
Posted: Tue Mar 13, 2012 5:02 pm
by billworld
I have a project for which I was advised to clone grouped objects. There are many dozens of these groups. To keep the design of the project manageable, I need to place each group on its own card. I then need to place individual groups on the main card. Doing so via the code below causes the card window to flicker as cards are switched. How do I prevent the flicker?
Code: Select all
on mouseUp
go to card Task
clone invisible group Task2
set name of it to Task3
place it on card Main
go to card Main
set the visible of it to true
end mouseUp
Re: cloning group
Posted: Tue Mar 13, 2012 5:21 pm
by Klaus
Hi Bill,
a "lock screen" should do the trick and please do yourself a favour and get used to put QUOTES around strings and names!
Code: Select all
on mouseUp
lock screen
go to card "Task"
clone invisible group "Task2"
set name of it to "Task3"
place it ONTO card "Main"
go to card "Main"
set the visible of it to true
end mouseUp
Best
Klaus
Re: cloning group
Posted: Tue Mar 13, 2012 5:45 pm
by billworld
Excellent. Thanks Klaus.
Also, is there a way to move the grouped vs just placing it on the new destination card? Placing it keeps a cloned copy on the source card. What I'd really like to do is simply move it. I searched the dictionary for "move" but that seems to show unrelated commands. Also attempting to delete the cloned group from the source card brings up a dialog to delete all instances of the cloned group. Need help understanding how to move the cloned group from card to card.
Thanks for the help!
Re: cloning group
Posted: Tue Mar 13, 2012 5:48 pm
by billworld
Also, yeah I'm aware of the need to quote literals, but I recalled reading about how LiveCode allows you to code without all the extra punctuation marks... so, I thought I'd try to see how it works in this respect. Anyway, I agree to be safe and to ensure the correct values are referenced literals should always be quoted. Thanks for pointing that out!
Re: cloning group
Posted: Tue Mar 13, 2012 6:14 pm
by mwieder
Also, is there a way to move the grouped vs just placing it on the new destination card?
Code: Select all
copy group "Task2" of card "Task" to card "Main"
Re: cloning group
Posted: Tue Mar 13, 2012 6:20 pm
by Klaus
Hi Bill,
instead of cloning and then pacing, you could eventually just COPY the group(s) to the target card!?
...
lock screen
copy grp "my group A" of cd "xyz" to cd "the current one or whatever"
set the loc of grp "my group A" of cd "the current one or whatever" to X,Y
...
On the other hand, PLACING does not put a COPY of the original group on the card!
It IS in fact the original (in your case CLONED) group!
Best
Klaus
Re: cloning group
Posted: Tue Mar 13, 2012 6:23 pm
by billworld
Thanks! Looks like the advice I received to clone was errant as what I really need was to copy. If there are intermediary steps such as resizing the group, is there a special way of handling that before it gets displayed thus avoiding any flicker visual distractions?
Thanks much.
Re: cloning group
Posted: Tue Mar 13, 2012 6:29 pm
by Klaus
Hi Bill,
just:
...
lock Screen
## do your resize etc. stuff here
...
will do
Best
Klaus
Re: cloning group
Posted: Tue Mar 13, 2012 6:30 pm
by billworld
OK I see how lock screen prevents flicker during any intermediary steps. Thanks for the quick help.
Re: cloning group
Posted: Tue Mar 13, 2012 6:40 pm
by Klaus
Yes, then the screen will be refreshed after a "unlock screen" or the end of the current handler!