LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use Ctlref in a event structure with a mouse up event?

Solved!
Go to solution

I have a large number of controls on a front pannel. I'm using a event structure that triggers the motion of a given motor when the corresponding control is pressed. However, I would like to avoid creating N mostly identical events, so I was planning on using a mouse down event on the front pannel, then retrieve the control reference using the Ctlref node (with gives "Reference to the control on which the event occurred" according to labview manual) and scan a array of references to find out which motor is supposed to move. However, it seems that this node does not appear (contrary to what the manual says).

I have found other ways to do what I need (I was thinking of using an array containing the coordinates of my controls and the coords node of the event structure), but I wanted to know why I can not find that node (which appears for "value change" event for instance). I'm using Labview 2013.

0 Kudos
Message 1 of 10
(3,491 Views)

It's there for me.  Can you give a stripped down example of your code that shows the problem?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(3,480 Views)

CtrlRef nodes do not always appear by default but, you can always resize the node or select item (just like unbundle by name elements)


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 10
(3,473 Views)

In LV2013 it did show up on default for me, when using more than one Boolean control for the same event case, as to be seen in the attached VI

0 Kudos
Message 4 of 10
(3,469 Views)

@comrade wrote:

In LV2013 it did show up on default for me, when using more than one Boolean control for the same event case, as to be seen in the attached VI


Interesting.  Every once in a while I run into things that behave "Strangely" on those data nodes.  I've never really known all the "Rules"

 

e.g. if an existing case with data nodes modified by the developer and wired to other nodes is edited or copied should (do) the default nodes appear and potentially break the case? Its probably some undocumented rule like that why it was not seen in that instance.

 

On a side note:  if you don't replace all of the code in that case (The loop, and the case structure) with a Search 1D Array primitive you may find that code featured on the Rube Goldberg threadSmiley Surprised


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 10
(3,457 Views)

Oh - the 1D Array searchSmiley Embarassed

Of course - I forgot. usually I employ variant attributes for keeping references...Smiley Tongue

0 Kudos
Message 6 of 10
(3,449 Views)

Thank you all  for your answer. Actually, I can find the Ctlref node when using a mouse down event on a control as in some of your examples. But here I am using a mouse down envent on the front panel, and while the coords node gives me the mouse coordinate, I cannot find the Ctlred node. Here is a image of that part of the vi (with a French version of Labview, sorry).

Ctlref.PNG

 

0 Kudos
Message 7 of 10
(3,422 Views)
Solution
Accepted by wboutu

Bad luck for you. Mouse down on panel does not have the control refnum as it is not operating on a control. Mouse down on a control does have it and since you can configure mouse down events on several controls in the same event case, it provides also a control refnum so that you can still operate on the control in question.

 

This is probably also the issue Jeff might have seen. When configuring multiple events for the same frame LabVIEW will only show the event terminal that are present in all of those events. Terminals that don't exist in at least one specific event of the multiple events for that frame are not selectable anymore.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 10
(3,415 Views)

Oh, OK. So I guess I'd better have a look at Comrade suggestion for the 1D array search.

0 Kudos
Message 9 of 10
(3,405 Views)

Here without the tremendously Goldbergish code...I'm still ashamed...

0 Kudos
Message 10 of 10
(3,391 Views)