My quest today began with a seemingly simple question:

If I have a button that gets data from a URL via libURL, how do I prevent a second request if the user double-clicks?

In this case we have too many entry points to disable and re-enable the controls that trigger URL access for that to be a practical option. Besides, occasionally libURL neither completes a URL request nor provides an error for it, so relying on disabling a control risks getting into a state where the control is disabled with no way to know to re-enable it.

In brief, sometimes GET or POST with libURL returns with no data in either "it" or "the result".

And looking through the forum and list archives, it seems I'm far from alone in this experience.

Then today I was working on this code in v8.1, when I encountered this new error message:

  tsneterr: Sync request already in progress

Hmmm...so now we need to rewrite the error handling for our URL code to account for new strings? Good to know.

So....

Does anyone here have a handler which reliably accesses a URL while preventing re-entrant attempts until the first one completes?

The example Dave Cragg offers on his web site is:

 global gUrlBlocking
 on mouseUp
      put "http://www.xxxxxx.com/images/mykids1.jpg"; into tUrl
      if gUrlBlocking is true then
        beep
      else
        put true into gUrlBlocking
        get url tUrl
        put false into gUrlBlocking
        if the result is empty then
          put it into image 1
        else
          answer the result
        end if
      end if
  end mouseUp
http://www.lacscentre.com/liburl/liburldoc.html#post

...but in practice I find libURL occasionally doesn't complete a request, nor provides any way of letting me know that, so gUrlBlocking never get cleared.

Who among us mortals has found a way to adequately handle error-checking in libURL with reliable consistency?

I imagine I'm missing something simple here. Hoping that's the case, anyway.

Fingers crossed....looking forward to any reasonable tips for reliable URL access....

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 ____________________________________________________________________
 ambassa...@fourthworld.com                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to