blank webcanvas

not sure what i’ve done, this was working i’m sure !

i have a webContainer with a webcanvas on it

when a user presses a button i create a picture of a graph
then invalidate the webcanvas to redraw it

in the paint event i have

if graphPic <> nil then
g.DrawPicture graphPic,0,0
end if

debugger in the paint event shows that graphpic contents are correct.

the web canvas never shows the graph though

im baffled!

Is graphpic going out of scope?

well, its a property of the webcontainer control. is that not good enough?

Should be. Do you have a breakpoint in the paint event? It could be that the browser is requesting the image and not getting a response if the app is paused.

it just doesn’t do drawpicture.

if i do drawrect in the paint event it works fine,

but using drawpicture the picture doesnt display.
when i debug at the drawpicture line, i can see my picture i the debugger and since the picture is a property of the container i think it must exist.

To draw an image on a webcanvas, the image has to be requested by the browser and put into its cache first. When the image is received, we trigger a refresh to have the canvas draw itself again with the image.

Remember, existing on the server is not the same as existing on the browser. If the browser hasn’t received the image, it can’t display it.

FWIW, I’m not aware of any bugs regarding this right now, but if you think you’ve found one, file a bug report. I’d be happy to look at your code.

[quote=209326:@Russ Lunn]not sure what i’ve done, this was working i’m sure !

i have a webContainer with a webcanvas on it

when a user presses a button i create a picture of a graph
then invalidate the webcanvas to redraw it

in the paint event i have

if graphPic <> nil then
g.DrawPicture graphPic,0,0
end if

debugger in the paint event shows that graphpic contents are correct.

the web canvas never shows the graph though

im baffled![/quote]

I remember encountering that a while ago. Which version of Xojo are you using ? Maybe that has been fixed.

Or, maybe you need to use a WebPicture instead of a Picture. See the constructor that takes a picture at
http://documentation.xojo.com/index.php/WebPicture

I changed it to an image view and a webpicture and it seems to work perfectly. Thank you!

You’re welcome. Glad it worked.