I have a text input field named salesprice on card 2 of the stack.
I want to display that value in a text field on the next card when I open card 3 of the stack.
I am brand new to this. I tried using the on openCard handler on card 3 but everything Ive tried produces nothing.
The on openCard handler send a message when I open any card and I get an error message on cards that don't have the salesprice field on them.
Passing Field value from 1 card to another card
Moderators: FourthWorld, Klaus, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Passing Field value from 1 card to another card
Hi trags3,
Welcome to the forum!
There are lots of ways of doing what you'd like but I think understanding how liveCode thinks (message path) is a better starting place. Take a look at this:
http://lessons.runrev.com/s/lessons/m/4 ... ssage-path
Notice how everything is "single" that is you only see 1 card and 1 stack in the image. That is part of your answer:
Since it is "single" it can only look at itself (the card) for a field called "myField" it has no notion of other cards in the stack.
But of course liveCode has a way to deal with this.
Now you have told it not to look at itself but some other card.
also
I wouldn't actually use on openCard probaly more on closeCard because you can use
put field "price" of this card into field "myField" of card "mySecondCard"
Can you figure out how to write your scripts from that?
Simon
Edit:
Another great resource
http://www.hyperactivesw.com/revscriptc ... ences.html
Welcome to the forum!
There are lots of ways of doing what you'd like but I think understanding how liveCode thinks (message path) is a better starting place. Take a look at this:
http://lessons.runrev.com/s/lessons/m/4 ... ssage-path
Notice how everything is "single" that is you only see 1 card and 1 stack in the image. That is part of your answer:
Code: Select all
on openCard
put 2 into field "myField"
end openCard
But of course liveCode has a way to deal with this.
Code: Select all
on openCard
put 2 into field "myField" of card "mySecondCard"
end openCard
also
Code: Select all
on openCard
put field "price" of card "myFirstCard" into field "myField" of card "mySecondCard"
end openCard
put field "price" of this card into field "myField" of card "mySecondCard"
Can you figure out how to write your scripts from that?
Simon
Edit:
Another great resource
http://www.hyperactivesw.com/revscriptc ... ences.html
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Passing Field value from 1 card to another card
Simon, Thanks, I'll try that.
Re: Passing Field value from 1 card to another card
Simon, Thanks for the help I used the "on closecard" handler and that works great!
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Passing Field value from 1 card to another card
Glad I could help
Simon
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!