09-18-2005 07:50 PM
09-18-2005 08:51 PM - edited 09-18-2005 08:51 PM
Hi Trupti,
Typically, one would use a Control (big 'C') and, when needing to use it as an Indicator, would update its contents via a local-variable (or its "Value" property.) However, the "Indicator" property of a control can be changed programmatically (via a reference to the control) - as long as the target VI is not running or part of (called by) a running program. The attached VI gets the reference to the first control on the FP of a subVI, and sets it to Control or Indicator. (You have to create the subVI "Untitled1.vi", and put a control on its FP.)
Cheers!
Message Edited by Dynamik on 09-18-2005 08:53 PM
Message Edited by Dynamik on 09-18-2005 08:54 PM
09-18-2005 09:56 PM
Hi Trupti,
I know this is a bad example... but it is simply to illustrate the point (so don't rate me on it 😉 )
See attached vi. as an example.
You probably do not have to change the property of the control to an indicator as it will act as an indicator by simply updating it's value.
You can change the value by creating a property node for the Control you wish to use as an indicator. This is done by right clicking the control and selecting property node. Click on the newly created property node and select Value. Click again on the property node and select "Change to Write".
I placed two property node within the Case Statement to illustrate. In reality, you only use the property node at the location you wish to display the desired value. I placed the one in FALSE to clear the value, if you run the vi continuously. The Case Statement is simply to illustrate the example, as well, permitting a selection of whether you'd want to display new info in the control or not.
If you explain why you wish to do this, we may be able to provide a more accurate example more suitable for your needs. But hopefully, this will help.
Good nite.. 😄
JLV
09-19-2005 10:37 AM
Trupti wrote:Is there a way to change a control to be indicator programmatically during run time. In my program, I want a control to be an indicator based on certain state conditions.
A front panel object is either a control (data source) or an indicator (data sink). In one case a wire comes out o it and in the other case a wire leads into it. Each wire on the diagram must have exactly one data source, but can have multiple indicators.
Whenever you change from control to indicator, you create a broken diagram because a wire will have now zero or multiple data sources, both situations break the VI. This cannot be allowed to happen at runtime! Same for subVIs, where controls are wired inputs and indicators are wired outputs.
08-21-2006 05:35 PM
I have a similar problem. I have a table indicator of values that loads during startup. I wish to make changes on that table during runtime and therefore have the data written out to various arrays. To do this, the indicator needs to be able to control. This indicator/control is 40 lines llong and 13 columns wide. It works easily in a manual execuition mode by itself, but in the running condition, the indicator table is just that, an indicator. I didn't really want to address one particular table entry at a time with a control as I need to be able to update several at the same time. The overall application is very large, but this one area is for a PID gain table to show the current values, but be able to update the running array structures as they are being read by other areas. Cuurently I'm doing this using an Excel spreadsheet/text file to get the controls into the software and wish to get away from this input method to active screen displays. Thoughts?
Thanks in advance.
David
08-21-2006 06:02 PM
08-21-2006 06:55 PM
Thanks, You had one idea there that I missed, that being the table is string information and it does indeed need to be checked for the proper format on each cell as such.
This table of PID gain entries is read from a master location and put into use. From there, I needed to change the table into controllable values that will then update the array structures in the rest of the code. This program has a total of 240 subroutines, so its rather large.
In my reference to "Manual Execuition" I was meaning running the one subroutine by itself to diagnose and implement the changes. When I run the main code, this display subroutine is updated every 300ms.
I found a way! I made a local of the table, created from it a property node with values selected. This now gave me two tables. Again, property nodes to turn off visibility on the now read only table, turn on the visibility on the control table. When done, reverse the visibilities. I sitll have a few issues to solve but on the way now, plus I will have to format check those table entries and again, thanks for the reminder there! That was an important one.
🙂
David