From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
09-26-2012 11:42 AM
Greetings,
I have 3 parallel arrays--one containing buttons and the other two containing string indicators. I'd like to be able to push a button and get the values in the other arrays. How can this be done?
(P.S. Illustrations are great and most welcome, but I do not have Labview on this computer, so I would appreciate it in jpg or screenshots if possible.)
Thank you!
Solved! Go to Solution.
09-26-2012 11:58 AM
09-26-2012 12:10 PM
Use an event structure for a value change of the boolean array.
Do a "not equal" comparison on the "new value" and "old value" event terminal, the use "search array" on the result to find the TRUE element. The output will be the index of the changed element. If you want latch action, reset the boolean array control to all false using a local variable.
09-26-2012 12:29 PM - edited 09-26-2012 12:31 PM
09-26-2012 12:37 PM
@altenbach wrote:
Here's what I had in mind. Modify as needed.
If you have the buttons initalized to all false, then you don't need to perform the Not Equal To. Just do a search with the NewVal. The local variable to reset the buttons should be wired to the OldVal.
09-26-2012 12:56 PM
@crossrulz wrote:
If you have the buttons initalized to all false, then you don't need to perform the Not Equal To. Just do a search with the NewVal. The local variable to reset the buttons should be wired to the OldVal.
Currently, the button array stays on the selected element for positive user feedback. Immediately resetting to false might confuse the user and we would need another indicator to show which was was pressed last.
(Your method is a bit dangerous in the general case, where e.g. several buttons could get changed at the same time from elsewhere in the program via locals.) Still, I agree my code is only one of many possible ways to do this.
09-26-2012 01:05 PM
Ah, I see what you're doing with it now. The only problem would be if somebody deselected the button.
Yes, my implementation was with the assumption that that was the only code affecting the value.
09-26-2012 01:37 PM
My current implementation does not allow deselection. If the user tries, that button is detected as changed and will be set true again immediately. All this can easily be fine tuned as needed.;)