Defining a lot of constants

Public Const CX as Number = &h0030

Can I create a text file with a bunch of constants defined as below into a class?
If so is there a file extension character set that must be respected?

You can manually edit the text and XML based save formats to mass-insert items, however you have to follow the save-file format for the item type which is not necessarily the same as Xojo syntax for the item type.

e.g., a constant in a text-based Xojo save file looks something like this:

#tag Constant, Name = CX, Type = Double, Dynamic = False, Default = \"&h0030", Scope = Public
#tag EndConstant
1 Like

It’s easier to do with the xml format, then save in whatever format you want. Note that this would involve writing a program to import a text file witht the name/value pairs and then spitting out the xml file.

Create, say, three constants in the IDE, select all three and copy them to the clipboard. Paste into a text document. That will give you a template. Once all the constants are ready, select them, copy to clipboard, and paste them into the IDE.

1 Like

That doesn’t always work. When you copy an object in the ide, sometimes the clipboard contains more than just text.

This was exactly what i tried ‘before’ I wrote this post. It did not work for me ‘at’ all… but then my Xojo could use an update.