hello everyone,
I have two sliders which has 5 values and those are edited with text labels so the display values are different and output of slider is different now i want move these two slider at same time.. for if slider moved the both should move like at same time like 10khz and 1 mirco sec, 20khz and 2 mirco secs, 30khz and 3 mirco amps and so on...
Hi Jeet,
@User002 wrote:
now i want move these two slider at same time.. for if slider moved the both should move like at same time like 10khz and 1 mirco sec, 20khz and 2 mirco secs, 30khz and 3 mirco amps and so on...
Why do you need 2 sliders at all, when their values should "stay synchronized"???
Why don't you use just one slider with labels like "10kHz/1µs"…"50kHz/5µs"?
Why are you so focused on using sliders? Why don't you use enums instead?
1. actually there is requirement in project to use only sliders so im so focused and sliders..
2. check text labels im sending two different values with different slider, Im attaching the sliders text labels.
is there another way to do it?
Your code "makes no sense". A Control should return the values it "advertises". Slide 2, for example, seems to "advertise" that it outputs 6 values, 0 (= Off), 10 k, 20 k, 30 k, 40 k, and 50 k. In reality, however, it returns the values 9, 211, 209, 97, 210, and 143. Note that a "slide control" implies a monotonic order of its outputs, not jumping around, up and down, as you are doing.
Before I looked at your code and saw how poorly you understood Controls and Indicators, I was going to tell you that you could use an Event Loop to keep the two Controls "in sync". But that depends on a better model for what you are doing.
If you want to keep you current design, here's a more rational way to do it:
When you set the Control, it will return a value of 0 through 5. What you, as the LabVIEW Programmer need to do, is to write a sub-VI (or a "function") that will take, say, 0, and know that you should use the "Off" value (say, 9). An easy way to do this is to build an Array with the sequential Values (which, for Slide 2, seems to be [9, 211, 209, 97, 210, 143]. You can then use Index Array (with the Array for Slide 2 and the Slide 2 value, 0 .. 5 as the Index, and get, for example, "211" if the Control is set to the Text Label "10 kHz".
Once you learn about Event Structures, you can learn how, when you change one Control, you can automatically read its value and write it into the other Control, so "Change one, change both". But I don't think you are ready for this yet.
Bob Schor
hey bob thanks for reply can you show me related example so i can understand it on better way
thank you
OK, I'm feeling very charitable ...
Take a look at the attached (if I don't forget to attach it) "Slider Demo". Please don't peak at the Block Diagram Yet!
Look at the Front Panel. Note that it has Slide 1 and Slide 2, both with Slider labels similar to yours, but both reporting integer values (0 .. 5 in both cases). To get the "true" value (shown in "Slide X Value", I apply a "conversion factor". But how do I handle "Off"? Ask yourself, is "On/Off" a numeric or a Boolean value? Can you take the Slide 1 "wire" and "transform" it to a Boolean that is "True" if "On" and "False" if "Off"? [This is called "Make One Control Do Two Jobs"].
I deliberately set the Sliders so that they start out non-zero and different (I suspect you don't know how to do that). Now, still without looking at the Block Diagram, run the program. Move the Sliders. Push the Stop Button.
Now look at the code. Simple, isn't it? The loop on top is called an "Event Loop" (because it contains an Event Structure).
Bob Schor
thank you.. but you forgot to add example
You need exactly one slide with sequential values and text labels having both descriptions, then index into a 2D array to get both parameters.
Oops, I forgot to add the example, my apologies ...
BS