LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically changing Slider scale range and limits using Case.

Thanks for Giving me your time. I am using a Case to flip between 2 different scales on a slider. 0-49, and 50-99. When It drops to the lower scale, It assumes the value is max and puts it there. This is causing problems because it should always start at the min value of the scale. Can you give me some ideas?

0 Kudos
Message 1 of 11
(4,925 Views)

Expand the property node, select the "value" property, and wire the desired starting value for the range.

 

(... of curse you need a little bit more code to only execute the property node if the boolean has changed. Is this part of a bigger program? A subVI?)

0 Kudos
Message 2 of 11
(4,914 Views)

Yes it is in a while loop that waits until all the settings are what the user wants, then the OK button exits the while loop and sends the info to the instrument. This is why setting the value to zero then does not allow the user to set anything other than zero. I wasn't expecting to add the while loop info, because I was hoping there was another way to set the other parameters without it adding a value based on fiction.

 

.... and It is in a subvi.

0 Kudos
Message 3 of 11
(4,884 Views)

Is this one of the reasons for using parallel while loops? ...and also why we can't have nice things? 😉

 

If so point me in the right direction, and I will learn how to do it!

0 Kudos
Message 4 of 11
(4,870 Views)

I don't understand your last two posts. Please show us how it all incorporates with the rest of the program and we might be able to give ways to improve things.

 

As I said, you only need to change the range&value when the boolean changes, not with every iteration of the loop. Easiest would be an event structure.

0 Kudos
Message 5 of 11
(4,859 Views)

Thanks for your time again. Ok I can do that. First of all I am limited with LabView 2009. So if If I should learn one of the event type processes I'm ok with that.. I will add the Subvi that this is used in. You will see what I am trying to fix with the Case, that Isn't going to work or you will shake your head and curse greenhorn's. 🙂

0 Kudos
Message 6 of 11
(4,838 Views)

....also within the larger context, this Subvi operates within a while loop.

0 Kudos
Message 7 of 11
(4,832 Views)

Indeed, if just the Subvi isn't enough, I will attach the whole thing. Pride is something I have in a product done well, and this is a work in progress.

0 Kudos
Message 8 of 11
(4,824 Views)

It's not fully clear to me what you are trying to do here.

It seems that if MHz is > 150 you set the slider scale to 50-99, otherwise to 0-49. However, no change is done on the slider value: what if the current value is outside the limits you want to enforce?

Moreover, as the tick count is a free running timer running from 0 to 2^32-1, the chance that it is less or equal to 50 or 100 is very small, so the output of the comparison in the smaller case structures will be true virtually forever.

Beware that assigning 0 to MHz- FT 2 has no effect on the code (it may not be wrong if you want reset the value for the next loop).

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 11
(4,813 Views)

Right, in the actual vi the MHz Slider might be set to 150, then that changes the MHz-Fine slider's scale to 50-99. But then they have to grab that slider and put it where they want it. Coincidentally in the 50-99 range the value always starts out at the lowest possible value, 50, but the 0-49 scale always starts out at 49. I think it is inherent in the slider itself.

 

All the limits are coerced via slider properties.

 

That tick count, I found the hard way exactly what you you said. It doesn't seem to reset if I flip the case, or also as you indicated I had the values way too low.

 

The "Beware" is right, can't seem to figure out how to force the Mhz-Fine to start at zero without the while loop just turning it into a flip flopping value.

 

Thanks Paolo

0 Kudos
Message 10 of 11
(4,808 Views)