Global Array and ComboBox

I’m trying to setup a global array with a list of items that can be accessed from one of many ComboBoxes that will be scattered throughout my application.

I can’t seem to get the syntax or placement down. I’ve tried putting properties and methods into a module…but can’t get anything to work with me.addrow in the Open Event Handler of the ComboBox.

So, for example, lets say we have s=Array(“Larry”, “Moe”, “Curly”)

Where and in what exactly should I stick this code, and how do I reconcile it with the Open Event Handler of me.addrow inside a ComBobox?

I would appreciate any help!

Thanks!

You can make s a public property of the Application.
Or you can make it a PUBLIC property in a module.

You can assign the values in the Application’s Open event.

If the property is a public one from a module, you can use

s(1) to refer to an element

If it is a property of the application, use

app.s(1) instead

or, if each of your combo boxes needs different values, you can assign the values to the array in the open event of the combo box. Just make sure you are referencing the PUBLIC property you created in the module.
A more OOP way would be to subclass the comboBox and create the property within that class. Each combo box throughout your app would be an instance of that subclass and have access to that property.

[quote=206070:@Eli Ott]Create a module.
Create a method within this module. Set its scope to Global.Name it something like ComboBoxValues.
Set the methods return type to String().
Put the following code in this method:

Return Array("Larry", "Moe", "Curly")

OK, and in the ComboBox Open what do I put in to pull them? me.addrow(ComboBoxValues) doesn’t work.

http://documentation.xojo.com/index.php/PopupMenu.AddRows

Got it. I needed to use me.addROWS plural.

Thanks eveyone!