Aesthetic: Module Constant Display

Xojo documentation

Xojo documentation example shows that in code you can specify that it is an Integer.

Const kAnswerToLife As Integer = 42

A property of a module or class can be declared an Integer. Its icon is a little ?
A property of a module or class can be declared as a Double. Its icon is a i in a circle[/i]

A constant of a module or class can be declared a number and its icon then become a (.01) in a circle which in general signifies a Double. In this context, it, however, can be a Double or an Integer.

If you enter an integer as the value of the constant, it will not display with ? in the IDE. Rather it will display as i in a circle[/i]. At least I cannot figure out how to make it display ? when I have entered an integer value.

Yet I am working on a project updating an old Xojo program. I notice in that project, some of the constants of modules which are integers in fact have ? associated with them. I prefer this because when looking at the IDE it makes it clear that the constant in question is an integer. Functionally, it makes no difference.

Is there some way to specify when creating a constant for a module that it is an Integer and not just a “Number” and have it display as ? ? Apparently this was possible in the past.

Not that I recall in the last 19 years in the IDE…and I do want to be able to specify the exact type. For one thing it’s a pain using constants to create an array using Array() for anything besides integer or double.

Anyway IIRC I believe the compiler does support it, so it might be possible if you save the project as as text or xml and edit it yourself to set the specific numeric type. Try it.

-Karen

Well, I learned two things.

  1. What IIRC means (I had to Google it)
  2. What 2 vs 1 means in the XML format of Xojo

Your suggestion worked. I saved the project in XML format and saw that my module constants that were displaying as ? had as their item type: 1 while my module constants that were displaying as b in a circle[/b] had 2.

So I changed the 2 to to 1 and saved the XML file and opened up the project in Xojo and, lo and behold, I got the ? displaying. It worked!

Now I think this would qualify as a long run for a short slide, but I like it. Very clever Karen.

It would be nice if there were a simpler way to achieve this goal. Perhaps someone knows one.

[quote=487938:@Robert Livingston]Now I think this would qualify as a long run for a short slide, but I like it. Very clever Karen.

[/quote]

I think I Norm had posted about it here or elsewhere and I just remembered it as I thought it SHOULD be supported in the IDE.

-karen