LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I programmatically change progress bar limit?

Hello all.  I have a custom control and one of the indicators is a progress bar.  The bar is used to show the position of a life test fixture as the fixture moves up and down.  I would like to have the max limit of the bar to be set by the user.  The user enters a number and the bar maximum will be that number.  That way the bar is more indicative of actual fixture movement.  How would I programatically do this?

 

I read about using the Range property, but I can't seem to access it.  Is this because the progress bar is part of the cluster?  Would I need to separate the progress bar from the cluster, get the Range property set up, then put the bar back into the cluster?

 

My problem here is that since this is a custom control, it is set as a typedef, with my vi using 12 copies of it.  So if I can't get the typedef to accomplish what I want, I guess I'll have to break the link between the typedef and the vi, go into the vi, and edit all 12 custom controls to do it. 

Message 1 of 13
(6,524 Views)

Without attaching the control(s), nobody can really answer your question.

 

I have a little question though:

A progress bar usually indicates the progress in percent (%). A progress of less than 0% or more than 100% doesn't make sense, does it?

Or are you talking about a "position indication"?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 13
(6,515 Views)

Hi Dhouston

 

please find the ZIP file attached. somehow i can't upload a VI 😞

 

Eventhough the cluster is a typdef control, you can still right click the slide inside the cluster and create a property node.

 

 create property node.png

 

hope this helps 🙂

 

RENN

Kudos always welcome for helpful posts 🙂
Message 3 of 13
(6,510 Views)

I do this all the time.  Mostly because I find it easier to just set my progress bar's maximum to be the number of loop iterations I expect and then I just have to wire up the i terminal to the terminal.  So much easier than calculating the percentage each loop iteration.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 13
(6,476 Views)

Thanks to everyone that replied.  Ok, in answer to everyone's responses:

 

@ Norbert_B

-Yes, I am talking about "position indication."  I just used the progress bar due to its vertical orientation since the fixture moves up and down--the bar is a quick visual indication of position since the fixture is enclosed in a heated chamber.  I have attached the file for your viewing.

 

@ RENN

-Oops, I should have mentioned it earlier.  We have Labview 2010.  There are company reasons why we have not and will not upgrade.  I tried to follow your procedure as you mentioned in your reply, but I do not get the options you have.  See the typedef slider options pic to see what I get.

 

@crossrulz

-Hmm, that is an idea, but when you say "wire up the i terminal to the terminal"  what "terminal" do you mean?  Are you talking about the terminal RENN showed in his diagram?

Download All
Message 5 of 13
(6,447 Views)

Dhouston wrote:

-Hmm, that is an idea, but when you say "wire up the i terminal to the terminal"  what "terminal" do you mean?  Are you talking about the terminal RENN showed in his diagram?


I mean the terminal of your progress bar.  But in your case, it is inside of the cluster.  So you would have to do some other manipulation to get it to work right.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 13
(6,441 Views)

Hey RENN.  I saw that your solution worked if I go into the vi and edit all 12 controls.  You said your solution would work even with a typedef.  The pic I attached showed the results I got when i tried to go into the custom control and change things. 

 

So it seems I have to edit all the custom controls.  Before I do that, is there any more information on trying out RENN's idea on the custom control?

 

I'll keep crossrulz idea in mind too.  Ah, so much to learn here.

 

I had a different program that had a similar issue, but without custom controls.  I was able to do RENN's solution on it, so it seems the custom control thing is a problem with this idea.  Is it a limitation of Labview 2010?

 

Being self-taught with a couple books sure is limiting.

Message 7 of 13
(6,320 Views)

Hi Dhouston,

 

sorry for the very late reply.

 

unpack the zip file and its contents to a folder. It contains an example VI and the custom control from your previous reply.

 

Before running the Example VI, check the max range value of all the Position indicators. Now select a motor using horizontal slide, set a scale range value and run the Example VI.

 

with this you can select one of the three motor indicators and set max value. If you can pack the code to a SubVi, a Functional Global variable then you are very flexible.

 

VI is written using LV2010SP1-f4.

 

hope this helps

 

RENN

Kudos always welcome for helpful posts 🙂
0 Kudos
Message 8 of 13
(6,191 Views)

I believe this is quite helpful RENN.  I have not used Global Variables before, so I'll hold on to that idea.

 

Let's see, there are two things that I am trying to figure out when trying to apply your vi code:

 

1.  Can you make the vi apply the Set Scale Range Maximum to all three typedefs simultaneously?

2.  How would you put this vi code in a loop so that the user can dynamically change the Set Scale Range Maximum during runtime? 

 

I think I can use most of what you have, but I tried taking out the parts with the Slide control.  Since I was trying to affect all three typdefs, I removed the Index array coming from the Build Array icon.  I was hoping I could grab control of all three typedefs by doing this, but Labview would not let me connect the Build Array with the Property Node. 

 

 

0 Kudos
Message 9 of 13
(6,167 Views)

If you want to change the maximum all at the same you will need to write the property nodes at the same time. By moving the control inside the loop you can change the value of the max range while the program is running. I suggest some error handling as well. This was just a quick example to answer your questions from the previous example posted. I just coped sections of the code that was previously posted to get the following picture. 

 

Capture.PNG

I had to use a 4 instead of a 3 because I manipulated the cluster to check a few things. To check this on a cluster, right click on the cluster type define then select Open Type Define. Right click on the cluster in the type define (on the edge) and select Reorder Controls in Cluster. You will see the order numbers for the controls. In my case the slide control was 4. 

 

 

Brad S. | National Instruments | CLA
Message 10 of 13
(6,122 Views)