01-14-2009 10:35 AM
I have 1D array that contains a cluster. The cluster contains a numeric and a boolean control.
If the user starts to edit the numeric control value i would like to call one subVI, and if the boolean control value is changed, call a different subVI.
The array control on the front panel allows the user to edit a number of the array elements.
I would like to use an event structure to detect a value change in the cluster. When editing the Events, in the Event Sources panel i get the option to select only the array, not the cluster within the array or the controls within the cluster. Can the Event structure be opened up to show controls within clusters and arrays?
The solution i am using is to detect a mouse up event on the array and then use property nodes to determine if the key focus is on the numeric, and a case structure to determine which subVI to call. This works, but is there a better (simpler) way?
Thanks, Blue.
01-14-2009 11:07 AM
You could decouple the array data from the user interaction by making a douplicate control to match the cluster type in the array and add an index control. when the index is changed show the user the value of the arrays index in the cluster control and when the user changes the cluster the event would update the array behind the scenes. This is just one possibility.
01-14-2009 12:36 PM - edited 01-14-2009 12:37 PM
You could compare the cluster old value to the new value and use a loop to index out the array elements for comparison to find the element that has changed.
The attached example is in 8.5.1 so I am using the conditional abort functionality of the for-loop. Its not available in earlier versions.
David
01-14-2009 01:41 PM - edited 01-14-2009 01:42 PM
Here's another simple possibility (assuming the outer array size is constant):
01-14-2009 01:51 PM
01-15-2009 06:51 AM - edited 01-15-2009 06:52 AM
Thanks for the responses guys.
The tricky bit was that i wanted the numeric control values to flag they were going to be edited, so i could call a subVI, before their values were changed by the user. This is done by using the key focus property node, - i need to detect changes on the fly rather than post the event. Probably didn't make this clear enough in my original post.
The array is of variable size depending on if the user decides to insert or delete elements. The user also has the option to click and edit the array without having to do to much scrolling through the array index, as the FP shows several elements at a time. The Event Structure does a good job of automatically determining which element in the array is being edited, and returning those values to the property nodes. Turned out simpler than i thought it might be at one point!
Cheers, Blue.
06-28-2017 12:31 PM
I like also this solution, which takes a table of Start- & End-Addresses in a configuration Subpanel, and change the End-Address @ a change of Start-Adress by the UI.
PS "Domain" is the name of the control on the UI, which displays [FieldAddresses] in app.ini
Best Greatings to all of you
06-28-2017 12:34 PM
@makoubaa wrote:
@I like also this solution, which takes a table of Start- & End-Addresses in a configuration Subpanel, and change the End-Address @ a change of Start-Adress by the UI.
PS "Domain" is the name of the control on the UI, which displays [FieldAddresses] in app.ini
Best Greatings to all of you
🙂