I have a button that posts some data to a web server with a LiveCode Server script, this script then returns some data.
If I click several times, too fast, things aren't working anymore. No data returned.
I have to issue a resetall command, or quit the stack.
If I just close the socket (i've tried), it doesn't seem enough.
So my questions is :
-if i want to avoid any trouble what should I do ? Disable the button at the begining, so the user can't click several times ?
Post to URL and the case of resetall
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Post to URL and the case of resetall
Hi,
Her eis something to test:
If you double-click on a button with this script, it will ask you if you really want that and if you do, it will close all sockets before continuing. Make sure to sue an existing URL (not bla.bla.com and not google.com).
Best,
Mark
Her eis something to test:
Code: Select all
local lBusy
on mouseUp
put empty
if lBusy is true then
beep
answer "Are you sure" with "Yes" or "No"
if it is "No" then
exit mouseUp
else
repeat for each line mySock in the openSockets
close socket mySock
end repeat
beep
end if
end if
put true into lBusy
put "http://bla.bla.com" into myUrl
post "hello" to url myUrl
put the result into rslt
put false into lBusy
put "ok" & rslt
end mouseUp
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Post to URL and the case of resetall
Thanks Mark for your idea.
I found another turn around : to disable the button (disable me) and then enable it at the end.
That way, if the user clicks like a crazy person, the POST operation is not blocked/jammed.
I found another turn around : to disable the button (disable me) and then enable it at the end.
That way, if the user clicks like a crazy person, the POST operation is not blocked/jammed.
Re: Post to URL and the case of resetall
Hi,
As I said, that's a bad idea
If something goes wrong, the button is disabled and the user can't use your software anymore until he restarts it.
Best,
Mark
As I said, that's a bad idea

Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode