WebCanvas Doesn't Compile

When compiling a Web app with webcanvas1.refresh I get an error message that says WebCanvas1 does not exist. If I remove the Web portion it compiles but the refresh doesn’t seem to work, even in a Timer event.

Are you calling it before the “Shown” event has fired? Perhaps in the “Open” event by or by the timer before the control has rendered?

Edit===
You could leave the timer off until the shown event of the webcanvas has triggered.

When dragging a WebCanvas over a webpage, it is named Canvas1 as default. Would that not be the case here ?

I would use Canvas1.Invalidate to trigger a redraw if necessary. It is less resources demanding. Note that the refresh cannot take place until the event is over, so calling it multiple times in the same event will do nothing.

The canvas is shown and the paint event has drawn on the canvas. I have Next and Previous Buttons and each one index’s a counter either up or down when clicked. A click also starts the timer. The images drawn are controlled by the value of the counter. So in the timer fire event I call for Canvas1.Refresh and reset the timer. I have tried invalidate also and that doesn’t work either.

Curves Form Shown Event
Timer2.Mode = 0

Previous Button Code
Index = Index - 1
If Index < 0 Then Index = 0
Timer2.Mode = 1

Next Button Code
Index = Index + 1
If Design.ID(Index).Text = “” Then
Index = Index - 1
End If
If Index < 0 Then Index = 0
If Index > 7 Then Index = 7
Timer2.Mode = 1

Timer2 Code in Fire event
Canvas1.Refresh or Invalidate
Timer2.Mode = 0

[quote=147468:@Larry Cluchey]The canvas is shown and the paint event has drawn on the canvas. I have Next and Previous Buttons and each one index’s a counter either up or down when clicked. A click also starts the timer. The images drawn are controlled by the value of the counter. So in the timer fire event I call for Canvas1.Refresh and reset the timer. I have tried invalidate also and that doesn’t work either.

Curves Form Shown Event
Timer2.Mode = 0

Previous Button Code
Index = Index - 1
If Index < 0 Then Index = 0
Timer2.Mode = 1

Next Button Code
Index = Index + 1
If Design.ID(Index).Text = “” Then
Index = Index - 1
End If
If Index < 0 Then Index = 0
If Index > 7 Then Index = 7
Timer2.Mode = 1

Timer2 Code in Fire event
Canvas1.Refresh or Invalidate
Timer2.Mode = 0[/quote]

This does not say much without the rest of the code.

The first thing I would do is verify Paint does fire when invalidate/refresh.

Place this in Timer2 action before you refresh/invalidate

System.Debuglog "Calling invalidate"

And in Canvas1.Paint :

System.Debuglog "Canvas1 Paint fired"

Then run your program and look in the messages (third icon at the bottom of the IDE central pane) if when your timer calls invalidate the paint event is triggered.

If Paint actually fires correctly, then you need to debug what you are doing in Paint. I suspect your issue is there.

Note : If you are using Mac OS X, the Messages show up fine.
But if you are using Windows, there is a bug that prevent messages to work correctly. You want to download DebugView from the Microsoft web site at
http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

Run before you start the program in Xojo ; it will give you all information.