How to cancel Upload/Download?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 76
- Joined: Sat Nov 07, 2009 7:43 pm
How to cancel Upload/Download?
Hi again,
I got Uploading and Downloading Files working but I would like to provide the User a Button to Cancel the Download/Upload.
How could I do that?
Best Regards,
Masterchief
I got Uploading and Downloading Files working but I would like to provide the User a Button to Cancel the Download/Upload.
How could I do that?
Best Regards,
Masterchief
Re: How to cancel Upload/Download?
Masterchief,
To answer your question properly, I'd need more information about your approach.
Meanwhile, I can tell you that there is an unload command:
Best,
Mark
To answer your question properly, I'd need more information about your approach.
Meanwhile, I can tell you that there is an unload command:
Code: Select all
unload URL "http://www.example.com"
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
-
- Posts: 76
- Joined: Sat Nov 07, 2009 7:43 pm
Re: How to cancel Upload/Download?
Well my Application lists all the files of a FTP Server in a listfield. The User can select the file he want to download. He presses the "Download" Button and my app downloads the selected File. And now the user has to wait until my Application finished downloading the file, before he can download another one, so I would like to provide the User with the possability to Cancel the Download while my App is downloading.
I hope this description helps you to understand my problem.
Best Regards,
Masterchief
I hope this description helps you to understand my problem.
Best Regards,
Masterchief
Re: How to cancel Upload/Download?
it probably helps not.
what commad do you use to download the file that you want to cancel. because how (or if) you can cancel it depends of course on how you are doing it
what commad do you use to download the file that you want to cancel. because how (or if) you can cancel it depends of course on how you are doing it

Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Re: How to cancel Upload/Download?
Hi BvG and Chief,
You can cancel the download, regardless of whether you use the put url command or a libUrl command.
When you start the download, just store the url somewhere. Use the
syntax in combination with the statusUrl function to poll the download progress regularly. Make sure to look up these commands and functions in the dictionary. You can use the info from statusUrl to update a progress bar.
For an FTP client, I made a window with a list. Each item in the list has a button and a progress bar. If the user presses the button during download, the download is cancelled by the command
I hope this helps.
Mark
You can cancel the download, regardless of whether you use the put url command or a libUrl command.
When you start the download, just store the url somewhere. Use the
Code: Select all
send in x millisecs
For an FTP client, I made a window with a list. Each item in the list has a button and a progress bar. If the user presses the button during download, the download is cancelled by the command
Code: Select all
unload URL
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
-
- Posts: 76
- Joined: Sat Nov 07, 2009 7:43 pm
Re: How to cancel Upload/Download?
Thanks BVG and Mark!If the user presses the button during download, the download is cancelled by the command
@Mark: I am really interested on how to do that. I mean, I want the user to press the button twice, first time starts the download second time it cancels the download, but how do I do that?
Best Regards,
Masterchief
Re: How to cancel Upload/Download?
for that you need to set a flag for example (for feedback reasons) you could use the label of your button for that:
Code: Select all
on mouseUp
if the label of me = "" then
--start download here
--don't forget to send in 0 seconds, and so on as mark specified
set the label of me to "cancel"
else
--cancel your url here
set the label of me to ""
end if
end mouseUp
on urlDone
set the label of me to ""
end urlDone
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
-
- Posts: 76
- Joined: Sat Nov 07, 2009 7:43 pm
Re: How to cancel Upload/Download?
I am sorry but this point is confusing me as I don´t understand it:
Best Regards,
Masterchief
What does it mean?--don't forget to send in 0 seconds, and so on as mark specified
Best Regards,
Masterchief
-
- Posts: 76
- Joined: Sat Nov 07, 2009 7:43 pm
Re: How to cancel Upload/Download?
Hi again,Hi BvG and Chief,
You can cancel the download, regardless of whether you use the put url command or a libUrl command.
When you start the download, just store the url somewhere. Use the
Code: Select all
send in x millisecs
syntax in combination with the statusUrl function to poll the download progress regularly. Make sure to look up these commands and functions in the dictionary. You can use the info from statusUrl to update a progress bar.
For an FTP client, I made a window with a list. Each item in the list has a button and a progress bar. If the user presses the button during download, the download is cancelled by the command
Code: Select all
unload URL
I hope this helps.
Mark
I was quite busy in the last weeks but now I have time to look into this again. Could anyone please tell me how to write a function that starts if a button is clicked twice? (First Time Starts Download - Second Time Cancels Download)
I know that I have to store the URL and that I have to use the unload URL Command to cancel the download, but how do I write a function that starts when the Downloadbutton is clicked twice?
Thank you very much,
Masterchief