Image disappears from Canvas

I have a Webcanvas within WebDialog. It works perfectly the 1st time I show the webdialog with the canvas.
I then close the webdialog, and re-open it, but the image disappears. Upon tracing through the code using googles Developer tools, the image does show up but immediately disappears when the following it calls Xojo.controls routines.

This is what it called 2nd time it is opened and the screen is blank. In quicksnapshot I am populating the canvas with an image.

quickSnapShot(‘MtyF50UW_video’,‘QQVBuSjP_canvas’,0);
Xojo.controls[‘QQVBuSjP’].setAttribute(‘width’,‘640’);
Xojo.controls[‘QQVBuSjP’].setAttribute(‘height’,‘480’);
Xojo.controls[‘QQVBuSjP’].editScript(2,‘context.clearRect(0,0,640,480);’,3);
Xojo.controls[‘QQVBuSjP’].runScript(5);
Xojo.controls[‘MFDadF0g’].setMode(1);
Xojo.comm.ajax.begin();

This is what it calls the 1st time when it works:

quickSnapShot(‘FMOxQzdk_video’,‘Gbny16Lj_canvas’,0);
Xojo.controls[‘Gbny16Lj’].setAttribute(‘width’,‘640’);
Xojo.controls[‘Gbny16Lj’].setAttribute(‘height’,‘480’);
Xojo.controls[‘Gbny16Lj’].editScript(3,‘var canvas = document.getElementById(\‘Gbny16Lj_canvas\’);’,0);
Xojo.controls[‘Gbny16Lj’].editScript(3,‘if(canvas) {’,1);
Xojo.controls[‘Gbny16Lj’].editScript(3,‘var context = canvas.getContext(\‘2d\’);’,2);
Xojo.controls[‘Gbny16Lj’].editScript(3,’}’,3);
Xojo.controls[‘Gbny16Lj’].runScript(1);
Xojo.controls[‘Gs9t4ecb’].setMode(1);
Xojo.comm.ajax.begin();

Thanks in advanced.

Pictures are tricky in WebCanvas because for the browser to draw the image, it needs to be cached on the device already. The first time it’s drawn, the images are omitted because the browser has nothing to draw. When we get the signal back that the browser got the image, the canvas is refreshed and picture should appear.

Looking at the segments of JavaScript, the only difference is that the first one is the canvas initializer and the second is an edit.

I suggest turning off the diff engine for that canvas and see if that fixes your problem. Then we can work from there.

Greg,

Thanks for the quick reply…

How do you turn off the diff engine for a canvas?

Thanks,

In 2015r3 and above, there’s a toggle for DisableDiffEngine in the inspector.

Could be handy if the docs showed an explanation of this ‘DisableDiffEngine’ setting.

Unfortunately i couldn’t find it in there. Paul something for 2016r1 perhaps?

DisableDiffEngine still needs explanation in the docs.