LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best Method, Array or Listbox?

Hi all,

 

I'm relavtively new to LabView and programming and I'm writing a measurement and analysis program.

It will be used to test many different parts and each type of part will have its own individual parameters for each test. The individual parameters for each component will be stored in the "recipe" for the component.

The user needs to be able to select a recipe to load or edit.

 

I had the idea of storing all the recipes in a 2D array with each new row being a new recipe. In this case how can I get the program to recognise a recipe being selected? So i can subarray or whatever to use and edit. 

 

Or is there an easier way to solve my problem involvin listboxes or something like that?

 

Many thanks..

 

Rkll

0 Kudos
Message 1 of 9
(4,861 Views)

RKLL;

 

You could use a multi-column listbox.  You would have to right your array of infromatio to the 'Item Names' property.  To get the selection method you want, right-click on the control and under the 'selection mode' submenu, select 'Hightlight Entire Row'.  Then the value of the listbox is the row selected.

0 Kudos
Message 2 of 9
(4,829 Views)

I don't know how complex your testing and system is, but you may want to consider looking into using LVOOP. Your part can be a class, and one of its data members would be its "recipe".

 


I had the idea of storing all the recipes in a 2D array with each new row being a new recipe. In this case how can I get the program to recognise a recipe being selected? So i can subarray or whatever to use and edit.


I don't understand what you mean about recognizing a recipe being selected. Are you selecting a part or a recipe? Does a part have multiple recipes? You need to separate data storage from data presentation. 

 

0 Kudos
Message 3 of 9
(4,826 Views)

Thanks for your help Jack, I'm workin on it now..

 

Smercurio, Im only quite new to Labview and application programming in general. I don't really want to tackle anything too complex. However i could get into it if it would be valuable to the project. 

 

Basically what i want is an easy way for the user to select a recipe. The recipe would be loaded into controls and give the user the opportuinity to edit and save the recipe again. I also need the ability to add new recipes when needed. 

 

I was thinking by having all the recipes in a 2d array, once the user clicks an array cell i could index the row into different controls and edit and save it back into 2D array when finished. 

 

As i said, I'm new to programming, let alone LabView, so if there is an easier, more user friendly way of doing this, I'm probably missing it!

0 Kudos
Message 4 of 9
(4,811 Views)

Possiblly the easiest way would be to pop-up a new window for the editing.  You can take the values from the line they select and set the control values.  Using the 'Prompt User For Input' express VI should work.  Once the hit OK, write the new values to the 2D array.  You can trigger the pop-up with a 'double-click' event from a listbox, or a run-time menu selection, or any other event you think makes sense to the user.

0 Kudos
Message 5 of 9
(4,802 Views)

Jack thanks for your help, my vi is working more or less how i would like..

 

One thing that's bothering me is that when the vi isn't running, I cna select a box and the whole row will be highlighted blue, however when the vi is running, it doesnt highlight any box at all, when i click or double click. Ideally i want it to highlight blue when the user double clicks it. 

Am i doing something wrong?

0 Kudos
Message 6 of 9
(4,771 Views)

It should have the behavior you want.  For the ones I use, when the VI is not running I can edit cells and the selected row does not change.  When it's running the selected row changes with a mouse click. 

 

Make sure that;

 

it's a control not an indicator,

the selection mode is 1 Item,

and the Hightlight Entire Row is checked.

Message 7 of 9
(4,766 Views)

ah ya, it was set to an indicator.

 

Working perfectly now.

 

Tanx for all your help!

0 Kudos
Message 8 of 9
(4,737 Views)

Here is an alternative solution.  Become familiar with LabVIEW configuration files.  A configuration file is like an ini file.  It has headers and information.  It can edited with a text editor, or you can use the special Labview config file functions.  These files have sections, keys, and data like the windows registry.  For your recipes, you could make the section name the recipe name.  Under each section, you can create keys which will hold your recipe data.  Here is an example:

 

[Chocolate Cake]  (this is the section name)

  Ingredient1 = flour  (the next few lines are the keys and values)

  Ingredient2 = chocolate

  Ingredient3 = Milk

  Method = Mix them all up and bake.

 

You can use the config file functions to build your recipe file.  You can display the names of all the sections (recipes) to a user and let them choose one.  Once chosen, you can use the config file functions to get all keys and data from that section.  The data can be assigned to variables and such.

 

Search for some examples using config files in LabVIEW.  I like using them because they allow very good organization of data, and the files are editable with a text editor like Notepad.  Check them out.

 

 

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 9
(4,717 Views)