That is the only reason.
When you use the url(
function, everything stops until the transfer from the server is complete. If that only takes a tenth of a second, no big deal. But what if for some reason the connection is slow and it takes 3 seconds, 6 seconds, 20 seconds? During that time, Panorama is hung. You can’t do anything – click on buttons, type, choose a menu, etc. (By the way, if the computer has no internet connection at all, the url( function will complete and return with an error immediately.)
If you use the urltask(
function, Panorama stays active while the internet transfer is taking place. You can click on buttons, type, etc. all while the internet connection is happening in the background.
A common use of the url(
function is to retrieve text from the web, then do something with that text, like this:
local webpage
webpage = url(...)
dosomethingwith webpage
In the example above, by the time the program gets to the third line you know that either the webpage variable contains the text, or there was an error. But you can’t use urltask( that way, because the data isn’t available until later. See Running Code After the Data is Downloaded (on the urltask(
page) to learn the correct way to do something with data you download with the urltask( function.
One place where Panorama X uses the urltask(
function is in the Site License wizard. This wizard contacts the ProVUE server to log on, log off, make payments, check history, etc. All of these operations are done with the urltask(
function so that Panorama X doesn’t freeze while waiting for the server. It made the wizard more complicated to write, but I think it was work the extra effort, at least in this case. If I’m doing something quick and dirty, I’ll usually just use the url(
function.
Jim