LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Identify Control under Focus

  Dear NI Tech Supoort,
 
I would like to be able to find which control I am editing for a complex structure (several controls of different types embedded into an array of clusters, and each cluster is a part of another array of clusters). I would like to be able to identify which control is being edited. If I use the FOCUS property, it cannot tell me which element of the array I am editing. What is the way around this?
 
Thanks!
 
Regards
Albert
0 Kudos
Message 1 of 7
(3,533 Views)

If you configure an event that is configured for "value change" for each of the elements in the cluster, the "ctrlref" will tell you which control you were editing.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 7
(3,528 Views)

Dear Ben,

 Thanks! The trouble is that it does not seem to work with complex structures (array of clusters of array of clusters of controls).

Another concern - what to do if I do not want to change the value? The idea is that I click on the part of the settings which requires attention and can fire a VI which would take the data from that control, do some calculations and change the value to the appropriate something...

The FOCUS property worked with the limitation that it finds which control inside the cluster is addressed but does not know which element (#) of the array this cluster belongs to.

Thank you for any additional input beforehand!!!

Regards

Albert

0 Kudos
Message 3 of 7
(3,499 Views)
Albert,

Have a look at the following discussion forum post:
http://forums.ni.com/ni/board/message?board.id=170&message.id=232219&requireLogin=False
altenbach posts an example of how to determine the array index when an element is changed.

In regards to your question about determining the index even when no change is made, you may find the following knowledgebase article useful:
Returning the Index of a Mouse-Selected Array Element in LabVIEW


0 Kudos
Message 4 of 7
(3,479 Views)

Devin wrote



In regards to your question about determining the index even when no change is made, you may find the following knowledgebase article useful:
Returning the Index of a Mouse-Selected Array Element in LabVIEW



Two questions:

Q1) What does the "2" wired to the For loop do?  (   Just teasing  )

Q2) That example does not return the correct results if the row is "0"!  Why?

Ben

 



Message Edited by Ben on 12-10-2007 05:30 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 7
(3,475 Views)
Thanks, Devin!
 
A small request - is it possible to post this example for LV 7.1?
 
Thanks!
 
Regards
Albert
0 Kudos
Message 6 of 7
(3,459 Views)
Ben:

Q1) You almost had me there!

Q2) Good catch.  You can actually get an index of zero by clicking at the very top of the first row, but things are definitely off for the first few rows.  The problem is that there is a label for the array on the front panel which gets included in the height property of the control, skewing all the vertical measurements.  You could account for this by either subtracting the hight of the label before doing the calculations, or by just right-clicking the array on the front panel, and uchecking "Label" from the visible list.


Albert:
Sure, no problem.  Here is the example in 7.1!
0 Kudos
Message 7 of 7
(3,443 Views)