Listbox instead of arrays

Hi
I have the habit of using listboxes all the time instead of using arrays because I can easely visualize the content while running the app, and then I just set them to invisible when the project is complete.
I was wondering what’s your judgement on this “trick” ? is it a common thing ? is it bad programming ?

thanks

I vote “bad programming”. UI controls are not an efficient way to manage internal data storage. A Dictionary or Array makes much more sense.

Ok
I was expecting some "real programmers write assembly code on napkins ! " jokes after my confession

That’s one of the most important things I ‘realized’ at XDC. I’ve been doing the same thing, filling the interface directly from sql…

Now, I plan to load everything into a data type and then present the data to the interface. Doing that will make code portable and much easier to build desktop, web, and iOS apps…

Hal I’ve been doing the same thing…I would love to see an example of what you end up doing…

Kenny

I’ll probably blog about it. We’re independent contractors and use FileMaker 90% of the time and Xojo the rest, but trying to change that ratio. :slight_smile: Our goal is to make Xojo work a but more like FileMaker in regards to how forms interact with the database.

I can ‘see’ how ActiveRecord from Bkeeney and STORM from LogicalVue could be used to make forms be kind of self aware… I just need to work it out…

Is this a conversation about avoiding arrays/dictionaries or separation of model and view? I understood Horacio’s question as being related to the first, while it seems that Hal and Ken are talking about the latter.

I avoid arrays and prefert Lisboxes because I can literally SEE the information “live” at runtime.
but I guess real programmers use arrays…

Hal, what is STORM…I don’t see it on LogicalVue’s website

I don’t think so. In order to save time building desktop, web, and iOS apps, you really need an intermediate way of storing the data and then present it. I just hope to make the form be smart, some how, and request what it needs. In FileMaker all of that kind of stuff is automatic…

Storm is here:
http://storm.logicalvue.com/index.html

[quote]I avoid arrays and prefert Lisboxes because I can literally SEE the information “live” at runtime.
but I guess real programmers use arrays…[/quote]

Using Arrays is going to be especially relevant with a web application. The dictionary, Array or other property set of your method will live on the server, while the listbox data will be moved straight to the user interface. Your preferred approach will move large chunks of data at one time, making the app less responsive. It is better to use the listbox as a “window” on the Array. You transfer less data at any given time, and the app appears more responsive. - Of course, this is not going to make much difference with very small data sets.

[quote=75712:@Horacio Vilches]I avoid arrays and prefert Lisboxes because I can literally SEE the information “live” at runtime.
but I guess real programmers use arrays…[/quote]
Here’s another reason to use arrays. Accessing the UI is not allowed from a thread but you can populate an array from the thread. Then you can have a routine that populates the ListBox from the array outside of the thread.

I would expect an array to be much faster too, and you can see the values in the debugger.

However, there is nothing to stop you from making a special Debug window that will show the values of your arrays in a ListBox. You can turn on access to it only in Debug builds or something.

More work, of course, but reusable if you do it right.