LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding control type from control reference

I have a stric type control (A) on the front panel of a VI. This control is a cluster made up of a number of instances of another strict typed control (B). Later control (B) is also a cluster made up of two controls, a check box and an enum.
In the VI there is a value change event handler for control A. (I have included the check box to conrol B, it previously had only the enum). There is existing code in that event handler that works on the enum control. When I check a box, event handler is called and it tries to detect which enum's value has been changed. Since none has been changed, it enters into an endless loop.
What I want to do is use the CtlRef (terminal?) of the event handler to execute the previous code if the control is enum, otherwise do nothing. (I'll place the code in a case structure). How can I find the controls type from CtlRef?
What are those things inside the event handler called (e.g. OldVal, NewVal, CtlRef)?

Thanks a lot for your time!
Have a very nice weekend!
0 Kudos
Message 1 of 16
(3,693 Views)

From what I understood of the description you provided, it appears that you are looking for the class ID of the controls.  Each control type has a class ID.

You can get the class ID's from the controls within a cluster.  

To see if I understood correctly, please see the attached example.  If it is not what you are looking for, please provide clarification (and do not rate my post).

Thanks.

R

Oops..  I didn't answer the 2nd part of your question.

OldVal is the value before the value change.  NewVal is the new Value (causing the value cvhange) CtrlRef is the control reference of the control whose value changed...  well... actually the one you selected to trigger the event case.  I mentionned value change because of the description.  Events can be triggered by other means than a value change..  Just wanted to make sure there's no confusion....  😮



Message Edited by JoeLabView on 08-08-2008 08:33 AM
0 Kudos
Message 2 of 16
(3,681 Views)
You can use the reference to the outer cluster (A) to get references to the inner clusters (B) by using the Controls[] property node. You then need to repeat the process from a B reference to get a reference to the enum. If all the clusters (B) have the same name, I am not sure how you identify which one you are checking.

You can also set up events for inner controls in the clusters.

The LV help refers to those things as Event Data Nodes. The help is not too helpful on usage however.

Here is a little example.

Lynn
Message 3 of 16
(3,676 Views)
Dear friend JoeLabView! Thanks a lot for your answer.
Are class IDs fixed? I mean do all check boxes have a single ID or IDs change for each instance?
Why can't I rate your reply? Is it for me alone or for everyone?
Is there a chart someplace where I can find the class ID corresponding to the control name (as we humans call them)?

Have a sweet weekend!

0 Kudos
Message 4 of 16
(3,669 Views)
Hi C.DOT,
 
Hope it helps.
Mike
0 Kudos
Message 5 of 16
(3,664 Views)
Dear johnsold! Could you, kindly, save the VI for version 8.2 and reattach. I'll be so grateful. I'll let you know if I need more clarification after using the VI.

Thanks a lot for the VI (and help)!
0 Kudos
Message 6 of 16
(3,667 Views)
Thanks a lot MikeS81!
That was an answer to one of my questions.
Do all Boolean's have the same ID (8). So class ID does not differentiate between different types of Boolean's?
0 Kudos
Message 7 of 16
(3,656 Views)
Here it is saved for 8.0.

Class ID properties are fixed. All Booleans have the same ClassID. You can look at the labels to tell which is which. I do not see any property to distinguish between types of booleans. Things like button size could give you a clue, but since sizes can be changed, it would not be very reliable.

What are you trying to differentiate? I cannot see why you would need to know programmatically whether a boolean is a button or a toggle switch.

Lynn
0 Kudos
Message 8 of 16
(3,649 Views)
Dear Lynn!
Thanks for the VI (aham! you forgot to attach it, please attach it, I'll be so grateful). Differentiation between booleans is not such a critical issue. I just wanted to expand my knowledge.
0 Kudos
Message 9 of 16
(3,630 Views)


C .DOT wrote:
Why can't I rate your reply? Is it for me alone or for everyone?  I wanted to avoid what happened with someone else 😉  Please disregard.. 

Did you have a look at the example I posted?  You can expand from it.  You could place a check box, and have a look at it's class ID.  You can also look at the properties of each chack box.  You should be able to retrieve it's label (name) which can then be used to identify it with it's reference.
 
R
0 Kudos
Message 10 of 16
(3,621 Views)