LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

enum elements or buttons?

Solved!
Go to solution

Hi,

 

I am re-designing the architecture of an existing program in LabView (And I am relatively new to labview myself). The current program has 17 tabs and using a Tab control, they are all inserted in a sub-panel. Due to the size of the program, and many SQL queries all at the same time, it is a bit slow. Now I want to use a side bar, and 1 Subpanel, to run only 1 subVI in the subpanel at a time. Based on many research, I decided to go with plugins (scalability, modularity...), and have the following code, which works fine, but it does not look good. I would like to have my SubVIs as a button press, not a drop-down. Any suggestions for improvement? (Please see attachments to understand my explanations) . Since I have the file paths, it is complicated to post the VI itself.

block_diagram_screen_enum.pngfront-panel_screen_enum.PNG

Seli6272@D
0 Kudos
Message 1 of 22
(876 Views)

Use a Radio Buttons control.  Its data type is an enum.

0 Kudos
Message 2 of 22
(856 Views)

How often do you think you will be adding or removing plugins?  Using an enum means you will have to manually add or remove entries whenever your plugin list changes and you will have to always manually correlate the enum position 1:1 with the array of plugins.

 

If you change to buttons you will have to manage them manually as well.  LabVIEW has no capability to add new buttons to a running VI in any way.

 

You could instead consider using something that can be set up on each run as you change your list of plugins.  A Ring control would be similar to your enum but be configurable during runtime.  A Listbox might be closer to what you want as you can see the entire list all the time instead of having to use a dropdown, and it also can be reconfigured during runtime.

 

I would also note that using the "Abort VI" invoke node as a way to shut everything down might work but it also gives your plugins no ability to do any final actions or to finish an action they are in the middle of.  I don't know what your plugins do but this could be bad if there's anything that they might need to do before shutting down or could be problematic if they were interrupted during.

0 Kudos
Message 3 of 22
(817 Views)

@paul_a_cardinale wrote:

Use a Radio Buttons control.  Its data type is an enum.


In a bit more detail, have a look at the description in this idea and this very old example.

 

On the diagram, a radiobutton control is an enum that has the labels of the booleans as items (not to be confused with the boolean text!) and the "value" is the name of the boolean that is currently true. Only one can be true at any given time (or also <none>, if so configured).

 

I would place the three function buttons inside a radiocontrol contains, but leave the stop button outside (and keep its latch action).

0 Kudos
Message 4 of 22
(814 Views)

@Kyle97330 wrote:

How often do you think you will be adding or removing plugins?  Using an enum means you will have to manually add or remove entries whenever your plugin list changes and you will have to always manually correlate the enum position 1:1 with the array of plugins.

 

If you change to buttons you will have to manage them manually as well.  LabVIEW has no capability to add new buttons to a running VI in any way.

 


But you can fake it using an array of clusters.  Have a transparent button with a string underneath for the "boolean text"

0 Kudos
Message 5 of 22
(787 Views)

@Kyle97330 wrote:

If you change to buttons you will have to manage them manually as well.  LabVIEW has no capability to add new buttons to a running VI in any way.


I am sure there us a reasonable upper limit for the number of radiobuttons (again, assuming that's what you want, i.e. only one can be true at any given time). You can easily show/hide buttons and change their boolean text.

 

Here's a simple example:

 

 

0 Kudos
Message 6 of 22
(778 Views)

Thanks Kyle97330, I will not be adding or removing anything during run time. The number of buttons will only change if an additional service/specific query is needed (maybe once a year?). This program is reading data from SQL data base, and just showing the available results, (e.g. products with associated tests for them, test steps, test results,...) Since there is no mathematical calculations, I am guessing abort VI is not harming my data. Do you have a better suggestion to close the subpanel without interrupting the ongoing action?

Seli6272@D
0 Kudos
Message 7 of 22
(755 Views)

@paul_a_cardinale This looks so cool! but I actually do not need to add buttons during run time. I only want to have them on a side bar, so that whichever is clicked by user, only that particular subVI runs in my subpanel. I am looking for a solution which allows me do this. However, I think having radio buttons are the best option. I will try it and let everyone know if it has worked for me. 

Seli6272@D
0 Kudos
Message 8 of 22
(745 Views)

@  I really like the second link you have posted,  I could implement that. My problem is, how do I display the associated subVI to each of my buttons? Can you point me in the right direction? These subVIs are sending SQL queries to the live data bank, and I want to close each, when the subpanel is closed. 

Seli6272@D
0 Kudos
Message 9 of 22
(738 Views)

did you look at my example? You ca easily substitute the boolean text according to the VI names obained from "list folder" for example. Personally, I would probably use a listbox to display all subVIs found, then you can just double-click an entry (for example) to load it. Much more scalable!

0 Kudos
Message 10 of 22
(703 Views)