From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Changing indicator type.

Hello,

 

I am wondering if there is any way to programmatically change an indicator type. I have a gauge indicator and i wish to replace it to a numeric indicator with a toggle switch. This toggle switch will allow me to go back and forth in between the types. One way to do it is by having both indicators in the front panel and use the switch to hide or show but it would be nicer if i don't need to add both and maybe a property node can do it.

 

0 Kudos
Message 1 of 7
(2,819 Views)

Showing or hiding a control is probably your best option.  You can also put each control in a tab, and then make the tab transparent.  Then when you want to see one control you change the tab to show the control you want.  Programatically creating controls at run-time is not possible.  It would be like changing the compiled code for an application, as that application is running.  Other options do exist too like creating subpanels of controls but that complicates things even more.  You might also consider doing the tab method, but then leaving the tab visible so the user can decide what view they want by changing the tab control.

Message 2 of 7
(2,800 Views)

Thanks for your time. You mentioned "Programatically creating controls at run-time is not possible". But i am not willing to create an indicator. I am just willing to replace it with a new type (change it from dial to numeric). Is this considered creating a new indicator??

0 Kudos
Message 3 of 7
(2,792 Views)

You already got some good advice. Another option would be to  show both at all times. All gauges have digital displays that can be optionally shown. You could even move the digital display over the gauge, similar to a mileage display on the speedometer of classic cars. Since the FP space is already occupied, you won't gain much by hiding the gauge. The digital display is useful for e.g. copy-paste the current value or showing the value with more precision.

 

Gauge.png

 

Of course if you make the digital display large enough to cover the gauge, you can just programatically show/hide the digital display to get the desired effect. (image has the elements offset to show both).

 

Gauge2.png

Message 4 of 7
(2,789 Views)

@josear04 wrote:

Thanks for your time. You mentioned "Programatically creating controls at run-time is not possible". But i am not willing to create an indicator. I am just willing to replace it with a new type (change it from dial to numeric). Is this considered creating a new indicator??


Editing the source, while the VI is in a reserved state isn't possible.  You can't even do this from the IDE, so of course you can't do it programatically.  You must first stop your VI, then you can edit it, then you can run it.  You could create a scripting VI that does this, but the result wouldn't be what you want, and would only work within the IDE.

0 Kudos
Message 5 of 7
(2,780 Views)

Thanks for all the responses. I greatly appreciate it. ill work with all the options you guys mentioned.

0 Kudos
Message 6 of 7
(2,762 Views)

@josear04 wrote:

Thanks for all the responses. I greatly appreciate it. ill work with all the options you guys mentioned.


Is this post really the solution to the question?  Just sayin'......

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 7
(2,746 Views)