I am having trouble declaring global variables/properties. I have inserted a Module and have create a method under the module. defined my variables in the method. But when I try to refer to them Xojo says they do not exist.
Variables defined within a method are only accessible from within that method, and typically cease to exist when the method returns. To create a global and persistent variable add it to the module as a property.
For my purposes, I have been moving away from modules and, whenever it makes sense, putting public methods and properties in the Application class. Then I call them with app.theName. On the property/variable front, I keep public/global ones to a minimum, under the “Global Variables are a Bad Thing®” principle.
it’s been a while since I made the change, but if you have a global variable theApp and set it to = application
then the properties are accessed faster.