LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control Slide in subvi by reference

Im stumped. I would like to display a progress bar in my main vi as a subvi analyzes a file. Simple right? I passed a reference of the slider indicator to the subvi. I created a Property Node, selected the 'value' property for the slider and set to write. Basically the subvi is analyzing data and changing the slider value based on file position. The VI crashes on the value property.

 

What am I doing wrong? Isn't that how you access a control on another VI?

 

---------------------------------
[will work for kudos]
0 Kudos
Message 1 of 8
(3,827 Views)

This doesnt work. Why?

subvi cant control slider.png

---------------------------------
[will work for kudos]
0 Kudos
Message 2 of 8
(3,819 Views)

Your front panel is not updated until the subVI is completed. You need a way to pass information from the subVI to main VI. In the attached example I used a notifier to pass the slide value and a while loop (that wait for notification) in the main to update the slide control.

 

Ben64

 

 

0 Kudos
Message 3 of 8
(3,812 Views)

Forget the previous post, I took a closer look and there is a simple reason why the slide don't update. The slide control is a  takes U8 values. The default maximum is 255. You are sending i/100 values to this control so the 2 possible values it can take is 0 and 1. Set N=255 and connect i to the property node value input and you will see the front panel slide update from 0 to the max 255 U8 value.

 

Ben64

0 Kudos
Message 4 of 8
(3,795 Views)

After verification the default slide max is 100. Go to slide properties -> scale to change the max value.

 

Ben64

0 Kudos
Message 5 of 8
(3,789 Views)

You can also change the slider representation to DBL and set the Range for Min=0 and Max=1 since the value you are writing will be a fraction between 0 and 1.

 

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 8
(3,776 Views)

For use cases like this I love to use an Action Engine to maintain the referance to the control.  Then I can call it from anywhere at any level in my code to update the GUI.

 

Here's a snippet of "UI Progress.vi" demonstating the concept.

Slide AE.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 8
(3,754 Views)

Thanks for the help guys. You're right I meant to divide by 10. Already set the slider to range 0 to 100

---------------------------------
[will work for kudos]
Message 8 of 8
(3,709 Views)