Page 1 of 1
Retrieving/Passing a Set Preference Value
Posted: Sun Mar 13, 2011 3:09 pm
by ctflatt
After successfully implementing Klaus'
excellent Preferences tutorial on the iPad (Part 1:
http://runrev.com/newsletter/october/is ... etter3.php and Part 2:
http://runrev.com/newsletter/december/i ... etter4.php), I am trying to retrieve a set "email" preference value from a substack and use it in the main stack.
Not sure how I would achieve the following:
From the main stack I need to pass a value from a sub stack in a URL.
I have successfully hardcoded the email into the script, but need to make the email value equal the set "email" preference...
Here's the script I have:
Code: Select all
iphoneControlSet sBrowserId, "url", "http://www.someserver.com/directory/index.php?email=someone@somewhere.com"
How do I get the value of the "email" preference (which is already set in a substack field) passed in this main stack script?
Does this make sense?
Thanks!
Re: Retrieving/Passing a Set Preference Value
Posted: Sun Mar 13, 2011 3:30 pm
by Klaus
Hi cflatt,
thanks for the flowers
Do this:
...
put ("
http://www.someserver.com/directory/ind ... il=someone@" & fld "whatever holds the mail address") into tUrl
iphoneControlSet sBrowserId, "url", tUrl
...
Or do I misunderstand this?
Best
Klaus
Re: Retrieving/Passing a Set Preference Value
Posted: Sun Mar 13, 2011 3:37 pm
by ctflatt
Klaus:
You're welcome! It was great...
The fld "that holds the value" is set in a substack... how do I reference a value from a sub stack in the main one?
From the main stack:
get the value of fld "email" of card 1 of substack "preferences"
put it into tEmail
put ("
http://www.someserver.com/directory/index.php?email=" & tEmail") into tUrl
iphoneControlSet sBrowserId, "url", tUrl
Does this look even remotely right?
:Todd
Re: Retrieving/Passing a Set Preference Value
Posted: Sun Mar 13, 2011 3:46 pm
by Klaus
Hi Todd,
almost correct! Remember that the obvious is often the corrcet way in LiveCode
...
put the text of fld "email" of card 1 of stack "preferences" into tEmail
put ("
http://www.someserver.com/directory/index.php?email=" & tEmail") into tUrl
iphoneControlSet sBrowserId, "url", tUrl
...
Best
Klaus
Re: Retrieving/Passing a Set Preference Value
Posted: Sun Mar 13, 2011 3:47 pm
by ctflatt
Klaus:
Thanks!
I'll let you know how it works... or not
:Todd
Re: Retrieving/Passing a Set Preference Value
Posted: Sun Mar 13, 2011 3:54 pm
by ctflatt
Klaus:
Sorry... getting a script error... I think it has to do with the quotes in what we've written...
Did I/we close them properly?
:Todd
Re: Retrieving/Passing a Set Preference Value
Posted: Sun Mar 13, 2011 3:58 pm
by Klaus
Hi Todd,
sorry, there is one QUOTE too much after tEmail!
This is correct:
...
put the text of fld "email" of card 1 of stack "preferences" into tEmail
put ("
http://www.someserver.com/directory/index.php?email=" & tEmail) into tUrl
iphoneControlSet sBrowserId, "url", tUrl
...
Best
Klaus
Re: Retrieving/Passing a Set Preference Value
Posted: Sun Mar 13, 2011 4:20 pm
by ctflatt
It WORKS!
Thanks a million!
:Todd