LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
cchipman

Event Data Node should indicate cluster's control number when cluster control triggers an event

Status: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined. 

I have an event case for value changes for each of several clusters on my front panel. I would like to react differently to each of the controls in the cluster that triggers the event. It would be good if the event data node had a terminal for the number of the control in the cluster that triggers the event that could be wired into a case structure to handle each control's change. Currently, there are a couple of examples that discover the changed control by iterating through the cluster's Control[] property comparing NewVal and OldVal (decibel.ni.com/content/docs/DOC-3492, decibel.ni.com/content/docs/DOC-20306). However, once it is discovered, you still have to do something with it. It seems the whole discovery step could be eliminated if the triggering control's number could be passed into the event case.

7 Comments
tst
Knight of NI Knight of NI
Knight of NI

Today you can do something like this relatively easily if you dynamically register for the value change event on the Controls[] property of the cluster. This basically registers a value change event for each of the controls in the cluster and they're all handled in a single case. You can then use the CtlRef terminal to get the label of the control which triggered the event.

 

I don't think the idea itself is bad, but personally I don't use value change events on clusters often enough to need anything more than that.


___________________
Try to take over the world!
Knight of NI

I'm wondering what would happen if the cluster's contents get renumbered.

cchipman
Member

Renumbering is a different issue. If you renumber your cluster controls then you have to adjust the cases in event case to handle them. You have to be aware of the effects of changing your code through out the program. If you dynamically change the numbering then you have to set up your event case to handle the changing numbering.

X.
Trusted Enthusiast
Trusted Enthusiast

I am not sure where that would get you? If you use New value and Old Value and a Comparison Mode>> Compare Element, you'll easily get the info you need (namely which element has been modified). In fact this will give you exactly what you are looking for (obviously you need to wrap it into a small subVI to save space):

 

ScreenHunter_003.jpg

AristosQueue (NI)
NI Employee (retired)

This is not information that LabVIEW should calculate for you because it would add execution overhead to a large number of event handlers that do not need that information. It is appropriate that you add that code where it is needed and only where it is needed. The data delivered by any event should be only the minimal set of data needed to communicate the event, without requiring additional processing. The loop to find which particular control changed should be done separately by the particular handler.

cchipman
Member

I am not familiar with the underlying code for LV but it seems that the associated number of the control is part of the cluster data. I am just asking for that information to be exposed. If I am wrong, then nevermind.

Darren
Proven Zealot
Status changed to: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined.