WebFile.FileDownloadDelegate

From Xojo Documentation

Method

WebFile.FileDownloadDelegate(File as WebFile)

Supported for all project types and targets.

Signature for the method to call when the browser begins downloading the file.

Examples

This example creates a WebFile to download. When the browser starts the download, it calls the specified delegate method:

Dim wf As New WebFile
wf.Filename = "test.txt"
wf.ForceDownload = True
wf.Data = "DownloadMe!"
wf.OnDownloaded = AddressOf DownloadComplete

// mDownloader As WebFile is a property on the web page
// A property is used so that it does not go out of scope
// when the method ends.
mDownloader = wf
If mDownloader.Download Then
// Download started, DownloadComplete is called when it finishes
End If

DownloadComplete is a method on the web page:

Sub DownloadComplete(wf As WebFile)
mDownloader = Nil
MsgBox("Download finished.")
End Sub