How to make a global array of floats "right" way

Ok, old school VB6 addict trying desperately to modernize, so cut me
a little slack here… what I want:

general declarations

Public global_answer(100) As Double

How do I achieve this in Xojo?

I am writing an app and in this app I need (I think I need anyway, teach me the
new ways if this no longer applies) a place to store a list of 100 numbers that
I want multiple functions to access. For example if:

I press push button I want to say global_answer(1) = val(text1.text)
I press push button 2 want to say global_answer(2) = val(text2.text)

I press push button 99 want to say global_answer(99) = val(text99.text)
(yes this is a stupid example)

The point is I want a “global” list… So not being totally stupid to the new
way of doing things, II have created a module named utilities. in utilities
I have created some properties. For example I created Gfloat (which is
a double) I can access this float from any part of any of the code by
saying utilitis.Gfloat = 3.1415 or in a different part of the code saying
result_string = utilities.Gfloat * diameter

The problem I have now, is that i need to declare an array of floats in
utilities. How do I do this? Is this even the “right” way to do this?

In order to ‘declare’ variables, (I mean “properties”) I use the IDE.
The IDE will not let me choose a type of double(100) that I want…

While I applaud the people who wrote the IDE, this process really sucks.
I hate not being able to type a dim statement, and being forced to use
a GUI tool for this.

Is there an equivalent to the DIM // Public in vb6 in Xojo?
If so, how and where??

So, whats the “right” way of doing this in 2019??? How far out to lunch
am I? Can someone please provide a simple working example?

Thanks!!

In a module
create a PROPERTY

global_answer(100) as Double

set its scope to GLOBAL

the Language Reference is you friend…

FYI… You only use “DIM” inside of methods… other levels of scope are created using the Propertys feature

OK can you show me exactly how to do this? When you say “create a property” how do I do this?? Do I do that by typing something in to the editor ( and if so where ) or do I have to use the right panel of the IDE?

Do I simply type
global_answers(100) as double

Into the editor?

I know this is a really stupid question but we’re just like create and make our very nebulous sometimes.

Thank you

You can also create the array as a property of your application or as a property of your application’s main window. Often that will give the array all of the scope that it needs.

MENU -> INSERT -> PROPERTY

is there a way to do it just by typing?
again, sorry for the uber stupid questions.

OK, for everyone as ignorant as me…
the trick is to create an array using the “inspector”
you need to type in the name AND the array size in the name field.
(You are not just specifying a name, you are also specifying that
it is an array, and you do that in the name field of the property
you are crating) – this was not obvious to me.

so, if you want to create a 2D array, you need to type the
following int the name field.

global_float(100,100)

int the type field, you would type
double (if that’s what you wanted)

As for the ‘default’ box – no idea…
scope: Global, cause that’s what I waned.

Thanks everyone… Get use to more stupid questions
from me, this is getting to be a little less painful and a lot
more fun.

—Lou

Unfortunately there’s no direct way to write a line of code that creates the array (or other property), but there are keyboard shortcuts that will create a new property (ctrl-alt-P on windows I think), and then you can use the tab key to go from field to field to enter the property’s info. So, you can do this fairly quickly once you get over the learning curve hump.

In the long run, I think you’ll find that having the project organized the way Xojo does it, will make things easier to maintain.