LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to programatically determine type of controls in a cluster

Solved!
Go to solution
Hello All,

This is my second post. Am using LabVIEW 8.6.

Am developing software to automate test system and also generate a professional report. My approach here is to make the report very much auto configured as per GUI design (in short changes in GUI programatically gets reflected in Report format), so as to have easy configurability.

To achieve this I should be programmatically be able to determine the type of control each cluster has and act accordingly. A cluster may have a set of controls and as well another cluster. This way I can put in a for loop and need not worry about any increment or decrement of element in the cluster!

I have access to “Controls[]” in property node of the cluster, but am unable to find a way to determine which type of control it is – Boolean (True/False), Text, Ring, Combolist, etc. If I get hold of this then I can put them in a for loop and take action on all controls present in the cluster depending on the type of control - Not all, there will be a default to take care of non-utilised controls and shall update as required!

Am just guessing - will variant be a solution to this or am wrong?

Also will it be possible to remove border visibility of a cluster in front panel, so I can have a structured program without getting reflected in front panel?

Hope to get a response.



Thanks and Regards,

Tirthankar De
0 Kudos
Message 1 of 6
(5,585 Views)

Cross-Post, (with a good solution)

It is considered good manners to include the other posts link as well.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 6
(5,577 Views)

Thanks for your post, am new but not sure whether posting in two separate forums (I assume LAVA and NI's Forums.ni are separate entity) is ok with this forum?

 

But I do agree with posting a link on both forums to link possible solutions. Thanks, shall keep that in mind for future posts!

 

I tried on the variants and came out with a possible solution but not the best, and exploring better ways of doing it.

 

As I get a better solution I shall mark it as a solution!

 

Link to another forum with possible solution - http://forums.lavag.org/How-to-programatically-determine-type-of-controls-in-a-cluster-t12631.html&p...

 

 

Thanks and Regards,

Tirthankar De

 

Message 3 of 6
(5,567 Views)

If you want to use the Controls[] property have a look at the 'Class' value of each reference:

 

 

To remove the border of (any) modern control, right click the border, select the brush tool, select the Transparant value (upper right corner), if you still see a little border hit 'Space' to select front and background color.

 

To see what can be done with the variant data from a control have a look at this custom probe. Where I use OpenG tools to get all the possible info on the data.

 

Ton

Message Edited by TonP on 12-11-2008 09:38 PM
Message Edited by TonP on 12-11-2008 09:39 PM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 4 of 6
(5,552 Views)
Solution
Accepted by topic author Imagineer

Dear All,

 

 

With inputs received so far, I have deduced a solution to my problem (see attachment)!

 

 

Steps to achieve it:

 

1] Select the "Controls[]" property of the cluster
2] Use an auto indexed for loop to act on each control refnum.
3] Select the "Class Name" property of the control refnum to identify type of control - Enum/Boolean/etc.
4] Use a case structure to act on basis of individual control type.
5] Using To More Specific Class Function VI typecast the control refnum to identified refnum
 - Use class specifier constant as type for typecasting, found in AppControl
For case of Enum, below are the steps.
5a] After placing class specifier constant, select Enum instead of generic refnum constant by clicking on the constant.
6] To get the value of index selecetd, use "Value" property to get value which is in variant format, so use variant to data VI to get the desired data.
7] To get the string of selected item, use "RingText.Text" property.

 


Similarly other controls can be accessed programatically on the runtime!!

A special thanks to TonP for Tip on controls to class !

 


Thats all folks!!

 

 

Regards,
Tirthankar De

Message 5 of 6
(5,528 Views)

I found a link having information on somewhat similar line: 

 

http://wiki.lavag.org/Control_References#.E2.80.9CFront_Panel.Controls_.5B.5D.E2.80.9D_Property

 

 

I have modified the solution to incorporate the best practices!

 

I shall update this link in LAVA forum so people benefit from this!

Message 6 of 6
(5,518 Views)