LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to generate event in response to property change?

Is there any way to generate an event in response to a control or indicator property change? If not, it might be a useful feature to have added to LabVIEW.

 

My application is I want to detect when the user changes an XY graph's Palette -> Active Tool property, and in resposne I would then programmatically set the same active tool on all my XY graphs. So far, the only proposed solution I have found is to create my own palette toolbar (https://forums.ni.com/t5/LabVIEW/How-to-detect-a-user-action-in-the-graph-palette-with-an-event/td-p...), but that feels a bit like reinventing the wheel, and that forum post I cite was almost a decade ago, so I wonder if LabVIEW has enhanced capability such that property changes can generate an event, albeit it appears not from a look at the events available in the event structure for an XY graph, but perhaps there is some kind of hack or overlooked approach?

 

I don't want to poll the property.

 

Thanks.

0 Kudos
Message 1 of 11
(1,630 Views)

In the Event structure i see Value change, Autoscale range change, Plot attribute change and Scale range change as standard events. If those isn't enough i guess you can register a MouseDown event and check which button is pressed.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 11
(1,589 Views)

Hello Banksey,

 

I thought, it is possible to catch the tool-change with some Mouse Enter and Mouse Click events, but this doesn't work since opening the menu for selecting the zoom tool looses focus of the graph control.

So I think polling is the best way to do it. See my attached example. I put the polling code into a sub-VI, communicating with the main VI via events, so this drop-in solution looks like you are getting an event with tool change.

For experimenting I left the first approach there (in diagram disable structure).

 

Graph Tool Cng Event Example.png

Greets, Dave
0 Kudos
Message 3 of 11
(1,570 Views)

Event Structures can detect a Plot Attribute Change

 

In one of my programs I rescale the Y-Axis whenever plots are added or removed using the Plot Visibility checkboxes

 

pabCapture.PNG

 

pacCapture.PNG

 

So you can just as easily detect an attribute change on one graph and then copy the attributes to all of your other graphs.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 11
(1,545 Views)

I think this is not the request of the TO. As I understood his question he wants a notification about the selected palette tool, not the plot attributes.

Greets, Dave
0 Kudos
Message 5 of 11
(1,531 Views)

@daveTW wrote:

I think this is not the request of the TO. As I understood his question he wants a notification about the selected palette tool, not the plot attributes.


Maybe... But they asked 

 

@banksey255 wrote:

Is there any way to generate an event in response to a control or indicator property change? If not, it might be a useful feature to have added to LabVIEW.

 

My application is I want to detect when the user changes an XY graph's Palette -> Active Tool property, and in resposne I would then programmatically set the same active tool on all my XY graphs.


So my solution (trigger event on property change and then copy properties to other graphs) is valid.

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 11
(1,521 Views)
To Dave's point, selecting a different tool from the graph palette doesn't trigger the "plot attribute change" event.
0 Kudos
Message 7 of 11
(1,506 Views)

 

 


@Gregory wrote:
To Dave's point, selecting a different tool from the graph palette doesn't trigger the "plot attribute change" event.


Sure, but once that tool changes a plot attribute it could trigger an event. 

 

I am just offering another possible solution here. I don't understand what everyone's issue is with that?

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 11
(1,501 Views)

I think we're just talking about different things. The Author asked about selecting a tool from the graph palette (like zoom method, panning), and then making sure the same tool is selected for other graphs. The tool selection appears to be exposed through the graph properties, but not through any events. Even if the tool is selected, and the user zooms or pans on the graph, no attribute change gets registered.

 

Capture.PNG

0 Kudos
Message 9 of 11
(1,493 Views)

Wow, I'm blown away with all the responses!

 

Overall, we seem to be coming to the same conclusions as my own. Regarding the polling approach, admittedly my resistance was more from a resource efficiency and speed perspective, but I've since realised that even polling has limitations as it it impossible to capture "Zoom to Fit" given that it immediately reverts to the previous active tool.

 

I guess this means that the only reliable approach is the same as it was a decade ago, namely to create a custom graph palette rather than link all the XY graph palette's in a one to many, or many to many, configuration.

 

Thanks, everyone!

0 Kudos
Message 10 of 11
(1,464 Views)