Copying a group

J. Landman Gay jacque at hyperactivesw.com
Sun Aug 3 11:47:00 EDT 2003


On 8/3/03 10:27 AM, Stephen Messimer wrote:

> Hi Jacqueline,
> 
> I may be thinking about this a bit too simply but heres my 2 cents.
> 
> Copying just places the object in the clipboard for future use. I can't 
> really think of an instance where the copy command ever places the 
> copied selection, be it text or object at some other location like say 
> the clone command.

If you use the copy command to copy a field, its text comes with it.

> If you can figure out a way to do this to a copied object w/o using the 
> paste command I would be very interested in learning how it is done.

The only ways I know of are clone and "copy to" -- the last does not 
interfere with the clipboard's current content. That is, "copy field 1 
to card 4" makes a copy of the field (with its text) without putting the 
object on the clipboard. That's what I want to do.

> In an application I am currently developing I use this method 
> extensively to copy groups ( my groups are not backgrounds tho).  I am 
> wondering why you would want  to copy a group with its backgrondBehavior 
> true more than once in any case.  Wouldn't it be easier to have a group 
> with its bgBahv set to true in the destination stack and just copy the 
> text you need instead?

Usually. But in this case, the destination stack is a printing stack 
that copies over the fields to print, and then does a printout. The 
group in the main stack is my PseudoTable, which is a simulated table 
object that is comprised of many fields. (You can download it at 
<http://www.hyperactivesw.com/downloads/pseudtbl.mc.hqx> if you are 
curious). PseudoTable resizes its cells dynamically to accomodate the 
text in each cell. It is very fast, so it wouldn't be a big deal to 
bring the text of each cell over from the main stack and then call the 
handlers that do the resizing before I create a printout. However, if 
the "copy" command would do what I want it to, I could bring the entire 
already-resized group over to the printing stack using only one line of 
script. Then the table in the printing stack would already have the 
content of the correct card from the main stack, and all the fields 
would already be sized properly to display their text.

So, to answer the question, I need to copy the group more than once 
because I need a different field layout for each card I want to print. 
The printing stack deletes its existing group, re-copies the group from 
another card of the main stack (with its uniquely-sized cells), and then 
prints it.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list