user selects but selection is stored in memory.....

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, asayd

user selects but selection is stored in memory.....

Postby chris25 » Sun Oct 20, 2013 12:50 pm

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.
chris25
 
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: user selects but selection is stored in memory.....

Postby jacque » Mon Oct 21, 2013 7:03 pm

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:

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


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:
Code: Select all
on mouseUp
  storeValue
end mouseUp


And the second button:

Code: Select all
on mouseUp
  getValue
end mouseUp


You'll need to tinker with these handlers to avoid the hard-coded "this is a test" and use whatever value you want instead.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3802
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: user selects but selection is stored in memory.....

Postby chris25 » Mon Oct 21, 2013 7:17 pm

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...
chris25
 
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: user selects but selection is stored in memory.....

Postby Simon » Mon Oct 21, 2013 7:29 pm

Hi Chris,
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!
Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3900
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: user selects but selection is stored in memory.....

Postby chris25 » Mon Oct 21, 2013 7:45 pm

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...
chris25
 
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: user selects but selection is stored in memory.....

Postby jacque » Mon Oct 21, 2013 8:22 pm

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?


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.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3802
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: user selects but selection is stored in memory.....

Postby chris25 » Mon Oct 21, 2013 9:01 pm

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.
chris25
 
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: user selects but selection is stored in memory.....

Postby chris25 » Thu Oct 24, 2013 5:13 pm

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
chris25
 
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: user selects but selection is stored in memory.....

Postby jacque » Thu Oct 24, 2013 5:19 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3802
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: user selects but selection is stored in memory.....

Postby chris25 » Thu Oct 24, 2013 6:24 pm

OH...kay. still getting used to this......thankyou.
chris25
 
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: user selects but selection is stored in memory.....

Postby SparkOut » Thu Oct 24, 2013 7:04 pm

pssst Jacque... they are handler names you made in your example up near the top of the thread ;-)
SparkOut
 
Posts: 1627
Joined: Sun Sep 23, 2007 4:58 pm

Re: user selects but selection is stored in memory.....

Postby jacque » Thu Oct 24, 2013 11:27 pm

SparkOut wrote:pssst Jacque... they are handler names you made in your example up near the top of the thread ;-)


LOL! But...but...that was THREE days ago!
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3802
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: user selects but selection is stored in memory.....

Postby chris25 » Fri Oct 25, 2013 9:30 am


:lol: ....I don't want to know....
chris25
 
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm


Return to LiveCode University

Who is online

Users browsing this forum: No registered users and 2 guests