01-11-2010 10:13 AM
Hi Group,
I am trying to parse an event structure in the following matter. I have a series of boolean switches, and a series of knobs. When any of the switches is toggled (changes value), one of the event cases is called. When the knobs change value, another event case is called.
Once inside the event structure, I need to parse which one of the controls generated the event, as the next step needs to be encoded accordingly. I have placed a Case Structure which should have as many cases as there are items generating that particular event.
I thought the source data terminal would offer that information, but as it turns out, it is not. What am I missing here? I know I can use multiple control objects to generate one particular event case and I as long as they are all the same data type, I should be able to see the correct data terminals.
Thanks for your help on this topic!
01-11-2010 10:18 AM
There is a CtlRef node (you may have to expand the nodes or click on another one to see it). That provides a Reference to the control that fired the event.
01-11-2010 11:00 AM
Thanks, Raven Fan!
I am using the Control Reference with a Property Node. I am trying to select a property that will allow me to segregate which one of the four controls generated the event.
I am feeding the output of the property to the Case Selector. However, so far I have not been able to find a property which gives me the correct cases on the Case Structure. Tried label, text, etc.
Per example, I am expecting to see the Case Structure to show me four cases, one on a per boolean basis.
Sorry for these dumb questions. I am a newby and am trying to do as much by myself as possible, but once again am stuck. Thanks for your input!
JIQ
01-11-2010 11:09 AM
Case structures will adapt the cases to enums or Error clusters but that is it.
There is NO enum identifying which of the controls was clicked.
In your case you could use the control label and wire that to the case structure then edit the case structure to match the label (ignore case may be useful) and make sure there is a default case to handle mistyped names etc.
Ben
01-11-2010 11:58 AM
I prefer creating a reference for each control, using Build Array to put them together and then use Search 1D Array to find the index using the CtlRef terminal. You can then wire that index into the case selector.
You may have a problem with this method if you're using 7.x, but it should work fine in later versions.