Xojo.RECT circular Errors

In Xojo 2019 r3.1 on Windows 10, I need to use a definition of RECT for declares when drawing tooltips.

I must define a RECT, as Xojo.RECT is already defined by class Xojo.RECT in API2 (this did not happen in API1).

Here is how I define a RECT:

Structure RECT
Left as Int32
Top as Int32
Right as Int32
Bottom as Int32
End Structure

The error is:

Redefined identifier. This name is already defined by class Xojo.Rect. Left as Int32

The next step was then to remove the RECT definition, and replace with Xojo.Rect. I then get the error:

Structures cannot contain Xojo.Rect fields. MyRect as Xojo.Rect

Is there a way to either:

  1. use Xojo.Rect in a structure
  2. ignore Xojo.Rect when using declares

As a workaround, I can redefine RECT as RECT1 and ignore Xojo.RECT which will allow me to use RECT in a structure.

Any helpful hints? Thanks.
(I asked this question on the other forums also)

Ok… add another issue for attempting to use Xojo.Rect:

External functions cannot use objects as parameters.

Module1.GetClientRect, line 2 -External functions cannot use objects as parameters
Declare Function GetClientRect Lib “User32.dll” (hWnd as Integer, ByRef lpRect as RECT) as Boolean

Edit: Another error that is related:

Module1.tagTOOLINFO, line 4 - Structures cannot contain Xojo.Rect fields.
MyRect as Xojo.Rect

Maybe define it as Rect_Api1?

When you move to Api2 then just do a find replace all _Api1 on your project and you should be good to go.

Hi Markus,

Yes, you are right, this works as a workaround.

Thanks!

Either use name besides Rect or Put Your Rect Structure in a module and use the fully qualified structure name, and use ModuleName.Rect or in a Class and use ClassName.Rect

You should not have to do that IMO as this usage SHOULD be unambiguous…

You can try to convince them that the current behavior is a bug… but I would not hold my breath for a fix or even agreeing it is a bug

Yes, I agree it is a bug. I will let Xojo determine what they think it is - bug or feature? :slight_smile:

Just an interesting note:

My question has been on the Xojo forums for almost an hour, and no responses. Within a couple of minutes on this forum, two responses.

Interesting…

1 Like

Xojo and the MVP’s have been quite quiet as of late

The NAME of the type is irrelevant when you just use it for declares
Call it Foobar for all it matters

The important thin is the size
Maybe name it RectForDeclares

Thank you Norman. I had hoped that Xojo.RECT could be used. Shrug.

Thank you, as always.

Edit: Sorry, autocorrect changed your name.

Yeah not for calling a declare :frowning:
Structures are needed there