10-22-2008 11:06 AM
My goal is to create a set of graphical controls showing that as one value increases the others must decrease, and vice versa. There will be three fill bar controls, and the sum of the three values should always add up to 100 (or less).
I'm sure we've all seen GUI's impliment functions similar to this, but I can't seem to find a *good* way to do it in LabVIEW.
I'm attaching my current unappealing rube goldberg solution, but I'm hoping someone can suggest a more elegant method (and help get rid of the rat's nest of wiring only a mother could love).Efficiency would be a plus as well, though this VI will be running in the lowest priority thread of my application.
Solved! Go to Solution.
10-22-2008 11:51 AM
Hi AlexK,
Thanks for the post!
I have to say this code is looking pretty good, your using shift registors and your effectively performing the logic steps required.
I for one could only recommend adding an Case structure, so if none of the values have changed, then to skip the rest of the code...
Kind Regards,
10-22-2008 11:55 AM - edited 10-22-2008 12:00 PM
Hi, Alex,
You can simplify your code a little bit if you will work with event structure (you can ger reference to the slider whic was changed, and then correct values for other two).
see attachment
Andrey.
PS
Upd:
Sorry, just checked - in the attached example the sliders will get negative values in some cases, but this can be easily corrected. The main idea remain the same...
10-22-2008 01:02 PM - edited 10-22-2008 01:03 PM
Thank you Andrey, that is the more elegant solution I was hoping for. I had considered using the event structure but couldn't figure out how best to reference the other two slide bars. Your array solution solved that nicely.
Thanks!
[Edit: You might notice my example had the same problem with slide bar values going negative as well. It's not a problem, I can fix that.]