LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Visible property by ref

Hi all,

I have a VI where I need to show or hide various items according to a config file. Each row on the Front Panel is a cluster containing a String & three LEDs as shown in 'FrontPanel.jpg'.
You will see in code001.jpg that I bundle up a Reference to the cluster & each of its elements & load them into an array. This array can then be accessed as a local variable, to allow easy access to the cluster and its elements throughout my code.

Now, onto the problem. Depending on the configuration some of the LEDs may need to be hidden. 'code002.jpg' shows the code to do this. The problwem is that this works perfectly when the source is run under Labview, but fails when built and run as a binary executable.  I tried hardcoding 'False' being input to the 'Visible' property but the LEDs remained visible, so I know that is is the property write that is failing & not the data or its tests.

Can anyone gives me any ideas as to why this should work in source form but fail when built? Any ideas on how to solve this?  BTW My LabView version is 7.0.

Thanks, Kimdino.

Download All
0 Kudos
Message 1 of 7
(3,187 Views)
You might be running into a race condition. Replace the local variable by a wire.

Felix
0 Kudos
Message 2 of 7
(3,168 Views)

What you've posted isn't really enough, but I can think of two options:

  1. There's a bug in your code and even your test of wiring a constant into the property did not get around that. Examples of such a bug would be that the actual code did not run because it was in a case structure or that you have other code which changes this back or that you have race conditions. The way to test this would be to place indicators in relevant points in the code to know that it really executes.
  2. There really is a bug in the bundling->unbundling->display process in the executable. One way of narrowing this down would be to start deleting code until this stops happening, but that would require some work.

By the way, you have a lot of duplicate code which I think you can get rid of by putting the clusters in an array. I know that the properties will be the same for all array elements, but there are ways to work around that. For example, you can replace the boolean with a color box and color it transparent when you want to hide it and you can replace the captions with transparent string controls. If you don't want the user to click them, you can set their disabled state to 1.


___________________
Try to take over the world!
Message 3 of 7
(3,165 Views)
Hi Felix,

It cannot be a race condition as the variable is written in the Initialise frame of a state machine & thereafter only read. However, I have replaced it with a wire and the problem remains. The wire needed to take quite a convoluted path to reach everywhere the data was needed so I am returning to the local variable.

Thanks, Kimdino
0 Kudos
Message 4 of 7
(3,153 Views)
The race condition with the local variable will Auto-Index the For-Loop with an array of size 0, so the loop wont be executed at all.
When you work in the developement enviornment, the race condition only (might) occure the first time you run the vi. Any subsequent run, the locale is already initialized correctly.

Felix
0 Kudos
Message 5 of 7
(3,149 Views)
Did you include the front panel of the VI in the build file?
I will suspect that is not the case.
By default the front panel of a VI is removed for build files unless it is the top VI, has the option 'open front panel on call', or some properties of the front panel are triggered.
So when you create a build you can say to builder 'include FP of this VI.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 7
(3,124 Views)
Hi tst,
Re your pount 1. I can verify that this section of code is reached as the 'Slave label' element is written to correctly. I have also tried adding other bits of code in the same block & they ran correctly.
Re point 2. I am begnning to think that this is where I am going to have to go. 

Something else I should perhaps have added in my original post is that all the References are behaving correctly in the property writes except for the Booleans, not one of the Boolean writes achieves anything.

About the duplicate code. The chosen method puts a lot of code in the initialisation section while keeping the main loop very simple. Once initialised all the main loop has to do is copy the monitored Boolean data to the LEDs value property. What you see is the result of having moved all the complexity to the part that is only run once. All the captions are hidden anyway, the write operation is just so that the the rds name (a handy diagnostic for our site engineers) appears in the help text.

Ton, not sure what you mean.  In this app all the subVIs with Front Panels (about 40 of them) are loaded on startup, but are programmatically displaed or hidden as required. To this end the 'Show Front Panel when called' & 'Show Front Panel when loaded' checkboxes in each VIs properties are unticked. In the Build Dialogue / VI Settings tab 'Fieldbus IO.vi' (the troublesome one) has 'Remove Panel', 'Show Panel' & 'Run when opened' set to 'NO'. I don't know quite what these do but they work for all our other VIs which run in exactly the same fashion.

Thanks, Kimdino
0 Kudos
Message 7 of 7
(3,118 Views)