LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pointers

I am getting back into labview and have a question.  Is there a way to have multiple front panel controls all point to the same variable?  I can't seem to find a way to do this.  Everytime I put a front panel control it creates an independent variable on the control block diagram.  So if I want to display a value in 10 different places on my front panel I end up with 10 different variables defined on the back end 

0 Kudos
Message 1 of 12
(4,146 Views)

That's by design.  If you choose to show something at 10 places on the Front Panel, LabVIEW, by design, gives you the "freedom" to have them all show the same value (by wiring that value to all of the Indicators) or (by far the more common case) to have them show individual, not-necessarily-the-same, values (by wiring the appropriate values to them).

 

To do what you want, gather those 10 Indicators on the Block Diagram together, drag the Indicator Labels to the right of the Icon (so you can stack the Icons vertically), use the Alignment Tools to align the Icons on their left edges and distribute them without intervening spaces, wire the top Indicator to the Value you want, then wire the incoming Wire to the next, and the next, and the next, ... indicator.

Multiple IndicatorsMultiple Indicators

Bob Schor

0 Kudos
Message 2 of 12
(4,130 Views)

You don't get a "variable", just a terminal. Branch the wire from the data source to all of them.

 

Note that many indicators have additional displays built-in (e.g. digital displays of charts, tanks, etc. ) Often making additional terminals uneccessary if you make them visible.

0 Kudos
Message 3 of 12
(4,108 Views)

@altenbach wrote:

Often making additional terminals unnecessary if you make them visible.


Have a look here for an interesting example.

 

Oneterminal.png

0 Kudos
Message 4 of 12
(4,100 Views)

Use an event structure.

Example_VI_BD.png

aputman
0 Kudos
Message 5 of 12
(4,080 Views)

@aputman wrote:

Use an event structure.


Are you replying to any particular question? The question seems quite unrelated to event structures and you are just branching the wire as already suggested by Bob. Maybe I am missing your point. 😉

0 Kudos
Message 6 of 12
(4,075 Views)

I appreciate that but what if it is a control as well.  I can accomplish what I am after by making separate user interface variables but in most proprietary programming environments that have drag and drop user interface design when you drop a "control/indicator" it is a pointer to a defined variable.  Was just trying to not make my code to clunky with crazy amount of variables.  Or am I missing something?  Let's say my user interface is over 100 windows for example but want an e-stop on every window (via front panel push button).  I wouldn't want to create 100 boolean variables on the back end but rather one variable with 100 pointers right?

0 Kudos
Message 7 of 12
(4,069 Views)

Creating 100 windows is significantly more work than creating 100 e-stop buttons. Are all windows the same? In that case you can make it re-entrant and communicate conditions via notifiers for example.

 

Controls/indicators are NOT variables. They are UI elements to the data living on the diagram (e.g. inside wires, etc.).

 

I get the feeling you are barking up the wrong tree. Tell us more what problem you are trying to solve and we'll find a suitable and easy solution. I have not encountered many program that require 100 windows. Seems like a UI nightmare! How big is your screen? 

0 Kudos
Message 8 of 12
(4,065 Views)

Thanks.  I think I get it now.  I appreciate the help.  I was just concerned I was going to create a bunch of unnecessary variables.  Really appreciate it.

0 Kudos
Message 9 of 12
(4,039 Views)

I understand that but for example.  What if I had a setting, lets call "speed", and I wanted multiple places in the front panel to change the speed.  This variable also reads the current setting so you know what the current setting is before changing.  The example you gave would not update other variables.  

 

Another way to put this:

Lets say you have a home tab that shows general information about the entire system but has some basic control functions.  Can call it a boolean value controlling a light bulb.  Then there is a lighting tab that would display more advanced setting for this light bulb (maybe intensity and color as well).  On that tab you still want the ability to turn the light on and off as well as the other advanced setting.  Now you basically have to make the two variables talk to each other to display the current values correctly and also control the light correctly.  Now imagine you have 10 different places you do this.  Seems like there must be an easier way built in to handle this very common scenario (at least common to me).

 

Thanks in advance 

0 Kudos
Message 10 of 12
(3,747 Views)