Hi all, I’m confident this has probably been covered in other threads, I had a search, couldn’t turf anything up, hence the new post…
What’s with webcanvas objects not drawing in the browser (sometimes do, often do not) - I have a simple webcanvas, nothing special, an image being drawn in to its paint event (g.drawpicture…)
Any ideas on how I can make this more robust?
Thanks in advance.
I’m not sure about Web Canvas - but I can attest to the fact that Safari does not always load everything on a new Safari launch. My app works fine on an instance of Safari that is already loaded. I have a program using a plugin in which the plugin (only in Safari) has to be reset and reloaded twice for it to display. It took me several days to track that one down. I added code in an area to just reset/reload it twice.
I have the same problem. I am using a popup menus to select content for a graph. The web canvas shows the drawing or nothing when using the popup menu for selecting the content and triggering the paint event. Behavior seems to be random, at least I don’t see any logic.
I use the WebCanvas.refresh to trigger the paint event. For some reason invalidate doesn’t do anything.
Debugger shows that the paint event is triggered multiple times in the cases where nothing is drawn.
Same as David, anyone with an idea how to fix this?
The trick with drawing pictures is that they need to be transmitted to the browser before they can be drawn, but we don’t know that they need to be drawn early enough to send them first. Under the hood, we send all of the drawing commands to the browser along with the paths of the pictures, draw what we can, and trigger a download of each image. When each image finishes downloading, an event is sent back to the server to trigger another paint event. Once all of the images have made it to the browser, the last paint should be complete.
Now, all that said, it’s entirely possible for an error or service interruption to cause issues here, but usually the issues we see are around the fact that people are trying to draw very large images and they expect them to be automagically scaled down when in fact the framework just sends the whole image and tell the browser to do the scaling. Depending on the size of the image(s) and the users’ bandwidth, this sometimes means significant delays or even timeouts.
Thanks Greg for your explanation.
For any user that ends up here, I have been able to fix my problem of seemingly randomly having a drawing in a webcanvas, or not.
I used a “background” image to do drawing of a graph in a thread. After all the calculations and drawing was done I used the thread event UserinterfaceUpdate to trigger the paint event, which was supposed to draw the picture in the canvas. As mentioned this happened totally random.
What I did to solve was to take out the drawing of the background picture in the thread, and moved all graph drawing to the paint event itself. I am not having any issues anymore. Btw, the graph looks better, sharp now, as if the background image was scaled (although the size of the background picture was the same as the webcanvas).
I use image viewer instead of canvas. Image appears all time but there is a problem with clic on tactil Samsung screens. Otherwise, you have to use a single canvas on screen with generating picture before refresh (invalidate don’t work), but sometimes the image will randomly disappear until next refresh.