01-26-2013 12:59 PM - edited 01-26-2013 01:00 PM
LV 2011 SP1
I have a graph that can be resized, and it contains a front image:
WFGraph:Plot Images:Front
When the graph changes size, the plot image needs to be updated, but I can't find a "Graph Size" event to catch and handle. The shipping example for using plot images (<labview>\examples\general\graphs\Graph Pictures.llb\Graph Plot Area Images) constantly updates the image in a loop, but that's a non-starter for my application. I need to be able to respond to an event, not continuously redraw the UI.
I tried putting the graph in a pane using splitters and setting it to resize with the pane so I could catch and handle the "Pane Size" event, but the output of the "Map XY to Coords" method doesn't give updated values when I handle that event. I suspect the event is being fired and handled before LV's drawing engine resizes the graph to meet the pane's new bounds.
Has anybody figured out a way to do this? Surely LV provides some solution!
01-26-2013 01:30 PM
@David_Staab wrote:
I tried putting the graph in a pane using splitters and setting it to resize with the pane so I could catch and handle the "Pane Size" event, but the output of the "Map XY to Coords" method doesn't give updated values when I handle that event. I suspect the event is being fired and handled before LV's drawing engine resizes the graph to meet the pane's new bounds.
I haven't looked into this, and I'm assuming you're not using a filter event (if memory serves, there's no resizing filter event), but if this is the case, you could probably just fire another event (or use some other notifying mechanism) from the event case and do the updating in the second event. You might need to wait before calling the actual method (and be willing to accept race conditions, etc.).
01-26-2013 02:37 PM - edited 01-26-2013 02:41 PM
Update: Responding to the Pane Size event works now. I was using a notifier in my application to limit the number of redraws performed in response to the event, because I expected it to fire continuously as the pane resizes. The Wait on Notifier function, for some weird reason, wasn't responding until I put a probe on the refnum wire. (I have no idea!) After that, the redraw logic started executing and it worked.
I noticed that the Pane Size event fires very slowly. As a result my overlay only redraws itself when the user is finished dragging the panel (or once every second or so)...that looks kind of unprofessional. Any ideas for how I might get it to redraw more continuously while dragging the corner of the panel? Maybe a combination of Mouse Down and Mouse Move events...?
01-26-2013 03:43 PM
The mouse events won't help you in any case, because they only respond to events inside the panel. I'm not sure I understand the current issue, so I would suggest you upload a simple example demonstrating it so that we have a baseline.
01-26-2013 03:56 PM
Here you go: a simple change to the shipping example. Run it, grab the lower-right corner of the VI, and drag the corner around to resize. Two things to note:
01-26-2013 04:32 PM
What does the VI you posted have to do with your question? No event structure. No images. Not even any graphs.
Lynn
01-26-2013 04:49 PM - edited 01-26-2013 04:50 PM
Easy there, tiger. I posted the wrong file on accident. Here's the right one.
01-26-2013 06:00 PM
May I have the Map Graph to XY Panel Coordinates.vi, please.
Lynn
01-26-2013 08:20 PM
That's a dependency of the original example. It's also in <labview>\examples\general\graphs\Graph Pictures.llb .
01-27-2013 05:59 AM
It looks like this has nothing to do with the pane size event. If you run the polling case and add an indicator on the i terminal, you can see that the loop actually slows down considerably when you resize the panel. I'm not sure where it stops running, but it's not the obvious suspect, which is the XY-Coords conversion, because it still happens when you disable it. It seems to happen with every call to a property node (see the attached VI).
But that doesn't really help you. I don't know if the following will, but the example you posted can be handled simply by setting the point style on the plot. I'm assuming your real case needs something more complicated...
I'm also assuming that setting the object not to scale while resizing is not something you want, because that doesn't look very good either...