populating stack with field

J. Landman Gay jacque at hyperactivesw.com
Wed Jun 30 15:12:10 EDT 2004


On 6/30/04 1:47 PM, Bob Hartley wrote:

> Hi All.
> 
> I am almost a complete newbie and only made one app for my lab with a 
> lot of help from Sarah. I am back in runrev to make a labbook and I'm 
> making a testapp to try the concept. So please excuse the stupidity.

No question is stupid, and no apology is needed. We all had to start 
somewhere, and you've come to the right place. Welcome to the Revolution!

> 
> I only need to get me head around one thing then I'm off and running. I 
> hope you can help.
> 
> I have a main stack "mainstack" with buttons on it, one called 
> "Addtextfield" . I have 2 other stacks
> 1)"Textfield" with a card on it called "TextfieldCard" and a field in 
> this called "InsertTextfield"
> 2)"BlankStack" with a card called "BlankCard with nothing on it.
> 
> I want the button "Addtextfield" on the "mainstack" to duplicate the 
> field "InsertTextfield" and place the copy on on the card "BlankCard" on 
> stack "BlankStack"
> 
> I am using the script
> 
> on mouseUp
>   add field "InsertTextfield" to BlankCard
> end mouseUp
> 
> 
> This seems too simple and indeed it does not work. Am I missing 
> something simple or is it a lot more difficult than this.

It is as simple as this, but you need to use a different command. The 
"add" command is only for doing arithmetic when you need to add numbers 
together. What you want is the "copy" command (take a look in the 
Transcript dictionary for more info on "copy".)

The engine assumes that commands act on the current stack unless you 
specify differently. Because you want to copy between two different 
stacks, you'll have to specify what those stacks are. The full command 
would be (watch out for line wrap here):

copy field "InsertTextfield" of stack "Textfield" to card 1 of stack 
"BlankStack"

Don't be shy about asking anything else you need to know. That's what 
the list is for.

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


More information about the use-livecode mailing list