Updating Graphics and Canvas

I have an older project I am updating to the latest release. It has been a while.

I have a canvas that is a class, that is a color picker. It has a mouse up event with this in it.

dim c as color

c=me.FillColor
if SelectColor(c,“Select color:”) then
me.FillColor=c

me.Draw Graphics
ColorChanged
end if

It throws an error called “Expected a value of type class Graphics, but found a static namespace reference to glass Graphics.”

Then is the set color method I have this is throwing an error:

me.FillColor = c
me.Draw me.Graphics

"Parameter “g” expects class Graphics, but this is type Int32.

Please search the forum. This process was removed from Xojo years ago… All actions on the graphics context of a Canvas must be initiated by the PAINT event. This same issue was brought up just a day or two ago.

One simple way to handle this is to add a public color property to the app, (or the window, or a module)

Dim selectedcolor as color = &cc0c0c0

Then change you click code to be this (assuming the property is on the app)

app.selectedcolor = c me.invalidate

and put this into the Canvas’ Paint() event

me.Draw g

Oddly, the object referred to in me.Draw would be the Canvas, and the canvas does not have a Draw method
Is this a custom class derived from a canvas?
If it is, the selectedColor property could be part of the class