LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW 21.0.1f2 (64bit) Discard "Mouse Down?" Event does not work when clicking on graph's legend 'empty plot' item.

Solved!
Go to solution

Hi,

As the title says, discarding a "Mouse Down?" Event when clicking on the grayed part of an empty plot legend item will not actually discard the event, thus making the graph update its plot list with a bunch of empty plots. I figured this might be another so-called Design Pattern™, but just in case, I'm reporting it here as I feel this is not the expected behavior.

 

You'll find attached a mockup code to reproduce the issue. You'll also find a spotlight highlighting yet another design pattern which I find odd.

 

Sorry for the bluntness, I've been banging my head far too hard and far too long on the matter of making graphs (among other UI elements) behave exactly how I want them to. I appreciate the work the people at NI have done to make UI functionalities easy, but I'd like you to let go of my hand sometimes so that I can do my own stuff.

 

I'd be happy for any of you guys to prove that the issue is coming from my side so that I can fix it.

 

TL;DR : It doesn't work as expected, a fix would be appreciated.

0 Kudos
Message 1 of 11
(491 Views)

Follow-up to my previous message:
I have been experimenting with the plot legend in the development environment and have managed to reproduce LabVIEW crashes somewhat reliably. This occurs by randomly clicking on empty plot items’ visibility checkboxes, names, or previews. Doing so triggers several different internal fatal errors, such as:

 

“0x1A7102DF fpsane.cpp at line 553”
“0xC0000005 MemoryManagement.cpp at line 1550”

 

I have also managed to make LabVIEW freeze and then crash without any error message. I have several dump files pointing to invalid pointer usage within the LabVIEW executable itself, as well as within one of its resource DLLs, mgcore_SH_21_0.dll:

 

INVALID_POINTER_READ_c0000005_LabVIEW.exe!Unknown
INVALID_POINTER_READ_c0000005_mgcore_SH_21_0.dll!Unknown

 

As a side note, I have also discovered that the legend stops responding to clicks whenever it displays a plot with an index greater than 259, even if that plot does not actually exist (I swear I’m not mad). This value of 259 is particularly odd, as it is neither a power of two nor the maximum number of plots that can be configured using the graph’s “Legend:Plot minimum” property.

 

At this point, I have given up on trying to make the legend scrollbar appear in a built executable, as enabling it allows the user to crash the software with the following internal fatal error:

 

“0x6AD83CCC objmsg.cpp at line 178”.

 

I hope that this insane rambling will be of any help to somebody.

0 Kudos
Message 2 of 11
(298 Views)

As a side note, I have also discovered that the legend stops responding to clicks whenever it displays a plot with

>an index greater than 259, even if that plot does not actually exist (I swear I’m not mad). This value of 259 is

>particularly odd, as it is neither a power of two nor the maximum number of plots that can be configured using the

>graph’s “Legend:Plot minimum” property.

 

array index from 0, so it's 260 items.  This is not an odd number to C/C++ programmers.

for example, MAX_PATH, is a common constant.

 

 

George Zou
0 Kudos
Message 3 of 11
(260 Views)

Just confirming I was able to reproduce your errors in LV2023 Q3, even when I reproduced it from scratch. I never got any crashes but I didn't try building an executable. I was able to get the mouse discard events to not fire and was able to get the legend to stop responding after plot 259.

 

The Event Inspector window didn't show any additional events being generated, and I was also able to reproduce with the Silver and Modern palette XY graphs as well as the Fuse Design's Waveform chart- looks like it's something deep down in there.

 

There is a property called Legend:Disabled that prevents ALL user interaction with the legend. I tried something quick and dirty but couldn't find a combo of Mouse Down?/Mouse Move/etc. events to make it disable prior to the click. Interestingly, if you set that property BEFORE the click happens, then no new plots are created, but if you set it INSIDE the Event Frame next to the Discard? terminal then it doesn't work.

 

It appears that, somehow, the Mouse Down? event that's firing for that icon is happening before the Mouse Down? event gets filtered. I'm gonna guess the Waveform Charts are based off XControls, and the Mouse Down? property isn't getting set on ALL of the items inside the XControl. Then again, it doesn't appear to ACTUALLY be an XControl (at least not one we can edit) so it's not something we can fix.

 

Shameless plugs for my Idea Exchange entry that would hopefully let us "do more stuff" with the plots, like make our own legends or something:

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Decouple-plot-legend-tools-etc-from-the-plot-graphic-...

 

and for my request to make plots open source: https://forums.ni.com/t5/LabVIEW/Share-Your-Input-The-Next-LabVIEW-Feature-to-Go-Open-Source/m-p/442...

 

I think there are several other Idea Exchange entries about plots if you search.

 

I'd love to make new graph/plot legend, cursor, and plot tool items from a QControl. You'd use a normal graph as the main control, but never use its internal legend stuff. There is a TON of features you'd need to implement so I never found the time, but man, there are some things that REALLY need work with graphs.

Message 4 of 11
(255 Views)

Couple workarounds- apologies for the rambles- but you could add a Mouse Wheel event that detects when the user scrolls. If the legend scrolls beyond the limits you specify, you can manually drive it back to where it should be. You'll see a little glitch when the array exceeds its limits before snapping back again.

 

You could also detect Mouse Move/Mouse Wheel/etc. and move an invisible box over the legend. Then you'd never discard Mouse Down?, but you would simply let the invisible box "take" the click if you want to discard, and move it out of the way if you want to keep the click. Then put it back on Mouse Up or something.

Message 5 of 11
(254 Views)

Hi BertMcMahan,
Thanks a lot for your answers and for taking the time to test things.

 

>I never got any crashes but I didn't try building an executable.

I’m guessing that I might have corrupted the VI with all the experimentation I did, which would explain both the crashes on my side and the fpsane error.

 

>The Event Inspector window didn't show any additional events being generated, and I was also able to reproduce with the Silver and Modern palette XY graphs as well as the Fuse Design's Waveform chart- looks like it's something deep down in there.

Thanks for testing things I didn’t think about, such as trying other graph styles and using the Event Inspector. I’m relieved to know that I’m not the only one finding this behavior weird.

 

>There is a property called Legend:Disabled that prevents ALL user interaction with the legend.

I’m aware of the legend disabling property, but I don’t want to use it because it also disables the plot visibility checkbox, which I’d like to keep. The solution I’m going to go with is disabling the scrollbar regardless of the legend size, disabling clicks on the names and icons using the “Mouse Down?” event, and using the run-time menu to let the user customize plot attributes and plot visibility via custom dialog boxes. I’ll also avoid showing empty items by reducing the legend size to match the number of plots.

 

>Shameless plugs for my Idea Exchange entry that would hopefully let us "do more stuff" with the plots, like make our own legends or something:
(No shame in that, the idea is solid)

To be frank, I posted on the forums because I had already given up on finding an elegant solution to this issue, and I had very little hope of finding someone who had a fix for it. At this point it’s mostly an insane rambling and rant (and trust me, I could go on and on about the quirks of various controls and indicators (not just the plot legend) and the dirty workarounds people have had to come up with). I’ve been banging my head against this issue on and off for at least three years, and while I now have a partial solution by outsourcing the functionality to a user-defined run-time menu, I truly don’t find that satisfying.

 

I couldn’t agree more with your Idea Exchange post. I find the cursor legend to be even weirder than the plot legend: fewer (by which I mean none except "visible") of its properties are exposed to the developer, and to my knowledge there is no way to programmatically move or edit the cursor legend. I also find it odd that the Cursor List property array elements don’t expose all of a cursor’s attributes, such as Line Style or Line Width.

 

>and for my request to make plots open source:

I feel like “open source” is sometimes a way for companies to trick people who are tired of certain issues into fixing them instead. I hope I’m wrong, but as I mentioned, I have very little hope left.

 

I was sorry for my bluntness earlier, and now I’m going to be sorry for my bitterness. I’m mostly self-taught, so this is just my personal take and I may be completely off here.

 

 

0 Kudos
Message 6 of 11
(178 Views)

Hi George Zou,

 

You’re right, my bad it's indeed 260. I found this Stack Overflow discussion (https://stackoverflow.com/questions/1880321/why-does-the-260-character-path-length-limit-exist-in-wi...) explaining why the value 260 (1+2+256+1 or [drive][:\][path][null] = 260) and it makes perfect sense for the MAX_PATH constant.

 

I wasn’t able to find other examples of constants using a similar size, or any logical connection between the MAX_PATH value and the graph legend’s UI breaking beyond that point. I’d be very grateful for any insight.

0 Kudos
Message 7 of 11
(164 Views)
Solution
Accepted by topic author lbourdon

No problem, we've all had those pull-our-hair-out days with plots 🙂

 

And to be clear- I think there may be a way to use the Legend Disabled event intermittently. Basically, if you can keep it disabled, you could catch the MouseDown over the checkboxes and enable the legend to let the click go through. Then you'd disable it in the MouseUp event. Basically just invert the logic you're currently using- instead of accepting all clicks and throwing away bad ones, accept NO clicks and throw away good ones.

 

Or, you could just put an invisible square over only part of the legend- but that's a real pain if you have a resizeable display.

 

And be sure to Kudo basically all of the plot-based Idea Exchange entries you can find. The Advanced Plotting Toolkit once looked like a good option but it's been abandoned, so NI is all we have left 🙂

Message 8 of 11
(142 Views)
Solution
Accepted by topic author lbourdon

@lbourdon wrote:

To be frank, I posted on the forums because I had already given up on finding an elegant solution to this issue, and I had very little hope of finding someone who had a fix for it. At this point it’s mostly an insane rambling and rant (and trust me, I could go on and on about the quirks of various controls and indicators (not just the plot legend) and the dirty workarounds people have had to come up with).


I don't know if the attached falls under elegant solution or dirty workaround*, and I'll admit I haven't looked too closely at the details of the thread, but it's another tool to have in your tool belt. The basic idea is to use scripting to create a reference to plot legend (which is possible, since apparently it is treated as a standard control which is just not visible in the control hierarchy) and then use that reference to register for events, enable/disable as suggested in the previous comment, etc.

 

In my example, this at least prevents you from scrolling into the non-existent plots.

 

 

 

* Who am I kidding? It's in the dirty workaround camp.


___________________
Try to take over the world!
Message 9 of 11
(91 Views)

Hi tst,

 

Thanks for sharing your solution. I feel like you’ve introduced a new category into the discussion. Whenever scripting is needed to work around an impasse, it feels more like an exploit than a solution to me.

 

I’m actually really surprised that it’s possible to create a reference to the plot legend. Does that mean one could also create a reference to the cursor legend and access some of its properties? Could a reference be created to the legend’s plot icon, and from there modify its run-time menu or even remove it altogether? Probably not but one can dream, right?

 

I don’t have much experience with scripting. I understand the basics, but I haven’t spent much time using it in real projects, so I’m not entirely sure how to reproduce what you’ve done here . Would you mind attaching the scripting VI you used?

Thanks in advance.

0 Kudos
Message 10 of 11
(75 Views)