I have a table, it's basically a 2D-array of strings.... I have an event case, it's set up to trigger if there's a value change on my table. Does anyone know how I can find out what cell triggered my event case? Which element in the table had the value change?
My table is large and has some repeating strings, I'm trying to find the row and column indicies to the corresponding cell that had the value change.
Solved! Go to Solution.
I know this is an old thread, but I found an issue with this approach.
If you change a value and instead of selecting enter you click somewhere else on the table then you now have a value change event and your selection has changed, giving you the incorrect selection start.
I also excuse myself for digging up an old thread, but I do have the same issue.
Does there exist a method to prevent that behavior.
I tried using a multicolumn listbox, but that just complicated things.
Is there a way, to first process the value change event and later the klick an change selection event?
Thanks in advance
Rather than using the selection start property I would suggest using the EditPos property, as this tells you which cell you're actually editing.
This still has the same issue of showing you which cell you're currently editing, so I would suggest having a timeout case in the loop and reading the property in the timeout case (let's say every 100 ms). That way, when you get the value change event, you can use the EditPos value you got during the last timeout, which is probably the actual edited cell, as it's unlikely the user had time to give the cell focus and edit it in under 100 ms.
This is still somewhat flaky, so I would still consider using tbob's method, which could also be made cleaner by being made into a subVI and using a conditional stop.
Thank you tst,
that sounds like a very interesting idea.
I´m not a big friend of tbobs solution though, because the table might get bigger over time which might add
to the execution time. Even with the conditional stop.
At the moment I´m trying to "solve" my problem with a multicolumn listbox but I´m not very happy with some
inherent changes of the operation. For example, the inability to edit the values in the cells directly.
But I have built two VIs doing exactly the same. One with a multicolumn listbox and the second with a table.
I´ll try to implement your sugguestions and see which one works better.
Thank you very much
If you want to have both safety and performance, you can use a combination of the two ideas: Use the timeout case to monitor the EditPos and whenever it changes add it to a circular buffer with a few elements (for example a queue with a lossy enqueue or an array which you modify using Rotate 1D Array) and when you get a value change, check just the positions in the circular buffer to see which of them changed. Ideally, it will always be the last one, but just in case, this lets you have access to the last few cells you edited.