Hello
I am new to xojo and have already familiarized myself with a small project. Currently I have encountered a problem where I unfortunately don’t know what to do next.
The problem: In my desktop app I download an image from an URL and then want to load it into a specific canvas. There are about 20 different canvas in my project. This is because i want to load different images into different canvas.
When I now assign the image using MainCanvas.backdrop, unfortunately no image appears.
The following Code works, when i open the FileDialog an select the image.
// THIS WORKS
// Get filename from URL
Var con as New URLConnection
Var url As String = "https://MyUrlToMyPicture.jpg"
Var filenameLength As Integer
For i As Integer = url.Length - 1 DownTo 0
If url.Middle(i, 1) = "/" Then
filenameLength = url.Length - i
Exit For
End If
Next
Var filename As String
filename = url.Right(filenameLength)
Var downloadFile As FolderItem = SpecialFolder.Desktop.Child(filename)
con.Send("GET", url, downloadFile)
Var picFile As FolderItem
picFile = FolderItem.ShowOpenFileDialog("")
If picFile <> Nil And picFile.Exists Then
Var pic As Picture
pic = Picture.Open(picFile)
MainWindow.MainCanvas.Backdrop = pic
End If
// This works NOT
.... same code as above ......
Var picFile As FolderItem
picFile = downloadFile
.... same code as above ......
I don’t get it. Why does the picture not loading into my canvas?
Can please point me someone into the right direction please?
Thank you in advanced.