Webcanvas. not drawing image web 2.0

I have a basic app with a single canvas, with the following code in paint, within show I invalidate the canvas.


The oval draws, but the image does not, it’s a normal jpg file which has been dropped into the project. Anyone else notice this issue?

I have the same problem after I upgraded to Xojo 2020 release 1. I wanted to check if this is a bug which will be fixed or I’m missing anything. My app was working fine in the previous Web Framework…

It would be helpful to get a bug report with a sample.

Is the image sized appropriately?

Here’s my code.


I drag and drop a JPEG image (550x340) into Xojo IDE. When I run, I only see the circle without the picture.


When I do this, I still don’t see the picture. I tested this on both my Mac and Windows computers. Again I coded this many times before in my app and it was working fine before the upgrade.

When I use ImageViewer control as below, I can see the image.


I have this issue too.

I read elsewhere that it is due to the browser not having fully received the image, prior to drawing the canvas. In my case, a reload or two of the browser and I get the image.

If that is the case, what technique would be best to force the canvas to draw after the image arrives?

I checked from the Feedback app that the bug has been reported and the status is “Reproducible”. Does this mean fixing the bug is in progress? I was hoping this to be done when I upgraded to Version 2020 Release 1.2 but the bug is still there…

This may be a bug they hold off on fixing until the WebCanvas is reworked. They’ve said in several threads that they’re going to change the library the WebCanvas is based on in a coming release.

You should add any additional information you may have to the Feedback report and maybe add it to your top cases.

Okay let me do so. By the way, is there any other way to load a picture and draw on it not using Webcanvas? Image Viewer can load a picture but I cannot draw on it…

Not client-side that I can think of without using the WebSDK to create your own canvas implementation or writing the JS to do what you want on the built-in component. I suppose you could create your image in your Xojo-side code then use the WebImageViewer to display it.

Thanks for the comment! That sounds creative but beyond my capacity. I may wait until they fix the bug.

Seems like there has to be a way to work around this. Somehow preload the image before controls are drawn? My first venture in to web 2.0 is a game that requires a map, that I can draw on. So far, my code is just displaying the map. Literally 3 lines of code at most.

I meant to say my code is ‘trying’ to draw a map. Is there a way to tell if the image I wish to display on the canvas is available at the client yet? Maybe a timer to poll that availability, then refresh the canvas?

Yes, update the canvas