Canvas Scroll Methods

I am developing a desktop app and want to display text flowing on a canvas. Currently, I have the x coordinate of the text as a property, and a timer that acts every 30 ms changes the x coordinate by 2 and performs Canvas.Refresh.

When I connected it to a large display of about 50 inches during testing, I noticed that the text on the screen flashed every time I refreshed it. This was not observed when testing with a 27 inch display.

I looked at the Documentation and found a method called Canvas.Scroll, which I tried with a sample app, but I couldn’t see the difference with Refresh in a simple test. Would it be better for me to use Scroll to solve the flashing of flowing text? Or could you tell me if there are any other solutions?

Hello @Kazuto_Nakamura can you show us your code?

Thank you for reply @Sebastien_REMY .

Timer action events:

xPos = xPos-2
CanvasMain.Refresh(0, 0, WindowWidth, 50)

Canvas Paint events:

g.DrawText Text, xPos, yPos
g.DrawText Text, xPos+g.TextWidth(Text)+WindowWidth/2, yPos
If xPos+g.TextWidth(Text)+WindowWidth/2 < 0 Then
  xPos = 0
End If

Actually, two drawtexts are executed. When the last character of the first text reaches the halfway point of the window, the first character of the second text appears, and when the first character of the second text reaches the left edge of the window, the x coordinate is reset.

Thank you.

Hello Kazuto Nakamura,
It runs smoothly on my 55-inch 4K monitor.

lauftext-demo.xojo_binary_project.zip (6.0 KB)

1 Like