Copy a field

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Copy a field

Post by RossG » Sat Nov 14, 2015 2:59 am

I have a field containing data.

I want to retain the data while re-using a function
which will destroy it.

I then want the data to be available
in a field with the same name as the
original

Have looked at a couple of possibilities
but can't find anything that will suit.

I can, of course, copy the data and bring it
back easily enough but would like to know if
there is a more "elegant" solution available.

Reckon that if I learn something new every day
for a year I'll be an expert.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: Copy a field

Post by RossG » Sat Nov 14, 2015 4:07 am

After further investigation I have found that "Clone"
will do the job very nicely.

What put me off was that the clone has the same
name as the original. Since that's what "Clone" does
I expected that the developer had realized this
and made appropriate arrangements but couldn't
get any clues from the documentation.

So I made a card to test.

Renaming isn't necessary: any commands apply
to the original not the clone.

Having cloned the field I wait until the procedure has
deleted its contents then delete the field. This gets
rid of the empty (original) and leaves the (full) clone
to do its job.

As the clone is offset from the original I'll move it back to
the position occupied by the original (even though it's not
visible) so that it won't be miles off the card if I ever need
to see it.

Neat.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Copy a field

Post by FourthWorld » Sat Nov 14, 2015 5:16 am

Sounds like a job for a custom property.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply