user selects but selection is stored in memory.....
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, asayd
user selects but selection is stored in memory.....
user selects but selection is stored in memory..... Yes I know this seems advanced for me, but having designed a very simple little app that has no purpose other than to teach Me, I need to know just one thing: The user will click on a button, but the information associated with this button/choice needs to be stored temporarily while the user is taken to another button and has to make another choice again, then the two pieces of information/choices will lead the user to the desired outcome?
Please just tell me where I can read/watch/learn about the principles behind this type of scripting/action. I simply do not know the correct/accurate preambles to type into a search box ( in other words I have no idea what words to use to ask my own question)
Thankyou guys.
Please just tell me where I can read/watch/learn about the principles behind this type of scripting/action. I simply do not know the correct/accurate preambles to type into a search box ( in other words I have no idea what words to use to ask my own question)
Thankyou guys.
-
- VIP Livecode Opensource Backer
- Posts: 7258
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: user selects but selection is stored in memory.....
This is typically done with a "script local variable." That's a variable that is declared at the top of an entire script, rather than inside a handler. When you declare a variable that way, every handler in the script can use its value. Other scripts can't, which is why it's said to be "local" to that particular script. See "local" in the dictionary.
You do it this way:
You can't put these handlers into either of your button scripts because the two buttons need to share the variable and they each have different scripts, so instead your mouseUp button handlers need to call these handlers from another script. In this case that third script should probably go in the card that has the two buttons. The script of the first button would be:
And the second button:
You'll need to tinker with these handlers to avoid the hard-coded "this is a test" and use whatever value you want instead.
You do it this way:
Code: Select all
local sMyAnswer
on storeValue -- first handler in the script
put "this is a test" into sMyAnswer
end storeValue
on getValue -- second handler
put sMyAnswer -- puts "this is a test" into the message box
end getValue
Code: Select all
on mouseUp
storeValue
end mouseUp
Code: Select all
on mouseUp
getValue
end mouseUp
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: user selects but selection is stored in memory.....
Hallo Jacque, thankyou for this, it gives me plenty to work on. By the way, you don't know where I can find the link to that beginner's PDF? I have searched at least 8 different links and pages to find it, I can not remember where I originally downloaded it from, actually found it on scribd would you believe, but you have to pay after clicking their 'download for free' button...Mmm...
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: user selects but selection is stored in memory.....
Hi Chris,
Here is a great collection of all things liveCode:
http://livecodesupersite.com/tutorials.html
Don't know about a beginners pdf.
Simon
Here is a great collection of all things liveCode:
http://livecodesupersite.com/tutorials.html
Don't know about a beginners pdf.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: user selects but selection is stored in memory.....
Hi Simon, would you believe it, not 10 minutes ago I found this very site as I was tinkering around for the PDF, must be somewhere...
-
- VIP Livecode Opensource Backer
- Posts: 7258
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: user selects but selection is stored in memory.....
I'm not sure what PDF you mean. Do you mean the User Guide? That's in the Resources stack (the icon is in the toolbar.)chris25 wrote:Hallo Jacque, thankyou for this, it gives me plenty to work on. By the way, you don't know where I can find the link to that beginner's PDF?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: user selects but selection is stored in memory.....
Hi, just found it. It was in the resource centre as you said. But in the user guide section, bottom right corner, says launch PDF. Finally.
Re: user selects but selection is stored in memory.....
Ok, I am having trouble finding Keywords. I was looking for "storevalue and "getvalue". I looked in the keyword list on revdocs / runrev, not there. I looked in the beginners pdf, not there, I looked on tutorials and typed in the words, they did not appear. They are not in the dictionary in LC IDE; So Maybe someone could be kind enough to point me to a dictionary of keywords please?
Thanks
Chris
Thanks
Chris
-
- VIP Livecode Opensource Backer
- Posts: 7258
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: user selects but selection is stored in memory.....
Neither of those words are keywords, which is why you can't find them. They must be variables the author set up in a handler.
When searching for keywords, you only need to look in the dictionary. If it isn't there, it's a user-defined variable.
When searching for keywords, you only need to look in the dictionary. If it isn't there, it's a user-defined variable.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: user selects but selection is stored in memory.....
OH...kay. still getting used to this......thankyou.
Re: user selects but selection is stored in memory.....
pssst Jacque... they are handler names you made in your example up near the top of the thread
-
- VIP Livecode Opensource Backer
- Posts: 7258
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: user selects but selection is stored in memory.....
LOL! But...but...that was THREE days ago!SparkOut wrote:pssst Jacque... they are handler names you made in your example up near the top of the thread
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: user selects but selection is stored in memory.....
....I don't want to know....