From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to trigger an event generated inside Xcontrol in main VI?

Hello,

 

I'm trying to pass an event generated inside a Xcontrol to the main VI. Basically I want to handle a XY graph zoom event inside the xcontrol in the VI that calls the xcontrol.

 

Is there a way to achieve yhis?

 

Thanks in advance

0 Kudos
Message 1 of 5
(3,414 Views)

It looks like this specific functionality isn't a thing yet. Here's a link to the Idea Exchange post about it.

 

A workaround could be to create a Property of the XControl that is a reference to a User Event of your own creation. You could set this property (when your application inits) and then use it to trigger a user event from within the XControl that is handled at the handling VI level.

I say Property because you wouldn't want the reference to need to be written along with the datatype of the XControl. If you set it as a property, then that property value is stored in the XControl's memory.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 5
(3,411 Views)

Think of your XControl as a special subpanel. Events on controls in a subpanel are handled by the subpanel VI. Here, it's the façade VI. In both cases you need to expose a user event to the calling VI, and like James said, it's really a User Event being read as a XControl property.

You will need to create a user event refnum containing the data of your choice, and add it to the State.ctl typedef. From this point you can create a Read-Only property in your XCtrl. In the calling VI you'll need to read this property and register the user event for the event structure sitting in your main VI.

 

See attached example (the chosen event is scale change)

 

--Eric

Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.

Message 3 of 5
(3,378 Views)

James and Eric,

 

thanks for your replies. I never used user events, so I quite don't understand the explanation. I will study the matter further.

 

Eric, could you save the example to LabVIEW 2013?

 

Thanks again!

 

 

0 Kudos
Message 4 of 5
(3,360 Views)

This is a nice example, I really liked it, but I found some trouble when trying to create several instances in the same VI of the XControl, after registering for the event two xcontrols, when I trigger this events by making changes in the Y axis minimun, for both XControl, the event handler can only execute the first register made, I attach an example.

 

I have two XControl, with each one registered with the scale changed event, but when I trigger each one event, the event handler only handles the first even for the two XControls.

 

I hope you can help me with this, thanks

0 Kudos
Message 5 of 5
(3,163 Views)