Weird script behaviour (was libUrlDownloadToFile & urlProgress)
Gerry
gerry.orkin at gmail.com
Wed Mar 23 17:57:02 EDT 2011
Jacq, the button is on the card, and isn't in a group.
g
-- photo site: http://gerryorkin.com
On Thursday, 24 March 2011 at 8:32 AM, J. Landman Gay wrote:
> On 3/23/11 4:41 AM, Gerry wrote:
> > This is the script that calls the handler:
> >
> > on mouseup
> > set the blendLevel of me to "10"
> > updateSongsList
> > end mouseup
>
> Where is the button located? On the card? In a group?
>
> >
> > This is the handler that it calls (I've xxxx'd out some domain details):
> >
> > on updateSongsList
> > local songsOnDevice, songListOnServer
> > play empty
> > hide button "stopButton"
> > put "Checking for updates..." into field "messages"
> > put url "https://xxxxxxxxxxxx.com/hrabisms/songsupdate.txt" into
> > songListOnServer
> > put the dgText of group "Songs" into songsOnDevice
> > if the number of lines in songListOnServer> the number of lines in
> > songsOnDevice then
> > put "Update received!" into field "messages"
> > wait 120
> > set the dgText of group "Songs" to songListOnServer
> > set the defaultFolder to specialFolderPath("Documents")
> > put songsOnServer into URL ("file:songs.txt")
> > else
> > put "No update received. Rats." into field "messages"
> > wait 120
> > end if
> > put "" into field "messages"
> > end updateSongsList
>
> I don't see anything untoward there. Something else is going on.
>
> > As I said previously, this script is not executed if it's in the card
> > script, but does when it's in the stack script. That's weird enough,
>
> It's explainable if the button is farther back in the message hierarchy
> than the card. The message path gets a little convoluted in background
> groups.
>
> > but if I place it in the card script and I use "Send updateSongsList
> > to this card" in the button script it starts executing the card script
> > from the top, and I can track that by setting a breakpoint against the
> > send command - it jumps from the button script into the card script,
> > and I can step through all the lines in that card script, executing
> > them as I go.
> >
> > Like I said, totally crazy!
>
> Did you happen to insert the card script into the message path?
>
> If it isn't already, try moving your button so that it sits directly on
> the card itself, not in any group. Keep its mouseup handler the way you
> have it above. That will put the card into the message path. Put your
> updateSongsList handler in the card.
>
> I'm not sure what's going on, but it sounds like some kind of message
> path conflict coupled with some kind of recursion.
>
> --
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list