Quotes around a variable
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 92
- Joined: Thu Feb 14, 2013 7:17 pm
Quotes around a variable
I have hunted and hunted and I'm stumped.
I have the following code to setup an inline browser:
iphoneControlSet sBrowserId, "url", "http//www.google.com"
everything is happy - my browser launches.
So now I want to call a few different URL's depending on which button on a card the user pushes.
I setup a custom property for the URL but it doesn't work with the following code:
iphoneControlSet sBrowserId, "url", cmynewurl
I think it's because I need quotes around the actual URL to make the iphoneControlSet command work. If I put quotes around the variable the program no longer knows it is a variable? (it thinks the text in the quotes is the URL)
If I try to store the "http//www.google.com" inside the variable that doesn't seem to work either.
I thought I could just use:
put & """ && cymynewurl && """ into cmynewurl2
iphoneControlSet sBrowserId, "url", cmynewurl2
but it doesn't like a single quote within two quotes?
Help?
I have the following code to setup an inline browser:
iphoneControlSet sBrowserId, "url", "http//www.google.com"
everything is happy - my browser launches.
So now I want to call a few different URL's depending on which button on a card the user pushes.
I setup a custom property for the URL but it doesn't work with the following code:
iphoneControlSet sBrowserId, "url", cmynewurl
I think it's because I need quotes around the actual URL to make the iphoneControlSet command work. If I put quotes around the variable the program no longer knows it is a variable? (it thinks the text in the quotes is the URL)
If I try to store the "http//www.google.com" inside the variable that doesn't seem to work either.
I thought I could just use:
put & """ && cymynewurl && """ into cmynewurl2
iphoneControlSet sBrowserId, "url", cmynewurl2
but it doesn't like a single quote within two quotes?
Help?
Re: Quotes around a variable
It should work with an unquoted string in a variable, so something else is going on here.
WHat does "the result" contain right after iphonecontrolset?
(can use an answer dialog to see)
Hopefully there will be a useful message displayed.
WHat does "the result" contain right after iphonecontrolset?
(can use an answer dialog to see)
Code: Select all
answer information "The result contains: " & the result
Re: Quotes around a variable
Try this before you set the browser to the new URL:
replace " " with "%20" in cymynewurl2
Seem weird but even where a URL doesn't have spaces, that code gets it to work.
Gerry
replace " " with "%20" in cymynewurl2
Seem weird but even where a URL doesn't have spaces, that code gets it to work.
Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.
Former LiveCode developer.
Now recovering.
-
- Posts: 92
- Joined: Thu Feb 14, 2013 7:17 pm
Re: Quotes around a variable
Sturgis, thanks for the suggestion. It seems with the answer code in there it just worked!
It seems I was using the variable correctly but I needed to slow down the operation to make it work.
I've now used:
wait 60 with messages
This is instead of the answer code to allow everything to execute properly. I should of tried this based on a previous post I had made where I discovered this.
One more question:
When I first load the page it does not scale to fit despite using:
iphoneControlSet sBrowserId, "autofit", true
When I press the reload button then it scales properly, any reason for this?
It seems I was using the variable correctly but I needed to slow down the operation to make it work.
I've now used:
wait 60 with messages
This is instead of the answer code to allow everything to execute properly. I should of tried this based on a previous post I had made where I discovered this.
One more question:
When I first load the page it does not scale to fit despite using:
iphoneControlSet sBrowserId, "autofit", true
When I press the reload button then it scales properly, any reason for this?
Re: Quotes around a variable
Hmm. Not sure why this is going on (either problem) but I can't test on IOS so am limited in how I can help.
First thing I'd suggest is a time increment smaller than 60 ticks. It might even work if you do "wait 0 with messages"
And again, while i'm not sure WHY you're having to do the wait with messages, it wouldn't hurt to try a wait 0 with messages (or wait 60 if 0 doesn't work) and see if it starts to work.
I havent' seen this issue with android, but I haven't really been looking for it either.
Oh, and another thought, it might work better if you break things out into different handlers. A sizing handler, a handler that loads a url.. This is pretty much what I do. A handler to manage browser instances, handler to navigate, another to refresh etc. Maybe this is why I haven't run across this issue. (though again, since I don't work with IOS not having seen the problem myself doesn't mean a whole lot)
Would you mind posting a non-working code sample so that I can test on android and see if it works or not? and if not so that I can look for alternatives?
First thing I'd suggest is a time increment smaller than 60 ticks. It might even work if you do "wait 0 with messages"
And again, while i'm not sure WHY you're having to do the wait with messages, it wouldn't hurt to try a wait 0 with messages (or wait 60 if 0 doesn't work) and see if it starts to work.
I havent' seen this issue with android, but I haven't really been looking for it either.
Oh, and another thought, it might work better if you break things out into different handlers. A sizing handler, a handler that loads a url.. This is pretty much what I do. A handler to manage browser instances, handler to navigate, another to refresh etc. Maybe this is why I haven't run across this issue. (though again, since I don't work with IOS not having seen the problem myself doesn't mean a whole lot)
Would you mind posting a non-working code sample so that I can test on android and see if it works or not? and if not so that I can look for alternatives?
-
- Posts: 92
- Joined: Thu Feb 14, 2013 7:17 pm
Re: Quotes around a variable
I have worked my way up with trial and error and it only starts working at "wait 40 with messages." Not a huge problem but time to move on.
As for the fit to screen problem, I've found a way with doAction "reload" at the line after resizeStack. It's a bit of a hack but it works.
Thanks for the help.
As for the fit to screen problem, I've found a way with doAction "reload" at the line after resizeStack. It's a bit of a hack but it works.
Thanks for the help.