Update Controls API2 Xojo.Rect / REALbasic.Rect

I do not have a specific question. I am posting this to potentially help someone with an error message that I found confusing, and it took me a very long time to unravel.

I applied to a project the Menu Item: Update Controls to API 2.0

There are a few things in your code that are likely to break. In this project, I was able to figure out most of them without too much difficulty.

What confounded me was an error message where I had an Event Definition arbitrarily called PaintDot. I had a Canvas class (Canvas1) that originally was a subclass of Canvas, but after the conversion is now a subclass of DesktopCanvas. PaintDot was an Event Definition in that class. In the Paint event of Canvas1, the line of code below occurs.

RaiseEvent PaintDot(g, areas())

The error message is:
Parameter “areas” expects class REALbasic.Rect, but this is class Xojo.Rect

I had created a subclass of Canvas1 (Canvas2) and that subclass had an Event Handler PaintDot. I needed to fire off that event by raising it in the Paint event of Canvas1.

If you look at the code window for Canvas1 Paint EventHandler you will see in small print
Paint(g As Graphics, areas() As Rect). The line of code that is raising the error seems compatible with that. Sadly, I was confused for a long time. [It might be nice if that small print said instead – Paint(g As Graphics, areas() As Xojo.Rect) and before the conversion Paint(g As Graphics, areas() As REALbasic.Rect)]

Anyway, the place that you SHOULD be looking when you see this error is the Event Definition of PaintDot. The parameters there will read:
g As Graphics, areas() As REALbasic.Rect

This is what you have to fix. You have to replace REALbasic.Rect with Xojo.Rect and the error will go away. The line of code flagged as erroneous will start working again although it has not been changed at all.