Canvas.Graphics gone?

My app has hundreds of lines that measure the width a string:

integer = canvas.Graphics.stringWidth( wordmeasured )

I haven’t run the app in a while, but when I do now I get an error message

Type “Canvas” has no member named “Graphics”

I assume the old code was deprecated, but what replaced it?

That was deprecated years ago. All drawing on a canvas must take place INSIDE the PAINT EVENT

[quote=460938:@Bill Mounce]My app has hundreds of lines that measure the width a string:

integer = canvas.Graphics.stringWidth( wordmeasured )

I haven’t run the app in a while, but when I do now I get an error message

Type “Canvas” has no member named “Graphics”

I assume the old code was deprecated, but what replaced it?[/quote]

Why not do a search in the forum. That question was aswered a lot of times…

If you’re just using it to measure strings, just use a picture’s graphics property…

just make sure you set the pictures graphics text font text size etc etc to the values you need

https://blog.xojo.com/2018/12/06/updating-code-that-used-the-graphics-property/