Retrieving/Passing a Set Preference Value

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Retrieving/Passing a Set Preference Value

Post by ctflatt » Sun Mar 13, 2011 3:09 pm

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!

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Retrieving/Passing a Set Preference Value

Post by Klaus » Sun Mar 13, 2011 3:30 pm

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

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Retrieving/Passing a Set Preference Value

Post by ctflatt » Sun Mar 13, 2011 3:37 pm

Klaus:

You're welcome! It was great... :D

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

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Retrieving/Passing a Set Preference Value

Post by Klaus » Sun Mar 13, 2011 3:46 pm

Hi Todd,

almost correct! Remember that the obvious is often the corrcet way in LiveCode :D
...
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

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Retrieving/Passing a Set Preference Value

Post by ctflatt » Sun Mar 13, 2011 3:47 pm

Klaus:

Thanks!

I'll let you know how it works... or not :)

:Todd

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Retrieving/Passing a Set Preference Value

Post by ctflatt » Sun Mar 13, 2011 3:54 pm

Klaus:

Sorry... getting a script error... I think it has to do with the quotes in what we've written...

Code: Select all

Script: missing "" after literal
Did I/we close them properly?

:Todd

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Retrieving/Passing a Set Preference Value

Post by Klaus » Sun Mar 13, 2011 3:58 pm

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

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Retrieving/Passing a Set Preference Value

Post by ctflatt » Sun Mar 13, 2011 4:20 pm

It WORKS!

Thanks a million!

:Todd

Post Reply