08-06-2015 08:46 PM
Hello all,
I've been working on automatically resizing the front panel of a VI I use very frequently on many different computers. It's all working quite well, but I've run into a strange bug that's driving me insane. A screenshot of where the problem occurs is below:
The rest of the code isn't really relevant (and there's a lot of it), but suffice it to say, I'm scaling the size of the waveform chart and it's accompanying legend according to a scaling factor that works for my application as determined elsewhere. The scaling factor is coerced to be between 0 and 1 as a double. It works beautifully for every value I've tested it on, except if the scaling factor I'm multiplying by is 1. When the scaling factor is 1, the legend width (LegWidth above) somehow gets 24 pixels added to it. Probing what I read from LegWidth, what I write to it after multiplying by the scaling factor and the scaling factor itself, everything looks great. It starts as 270, I multiply by 1.00, the value I write to LegWidth on the other side is 270 as expected. But the legend grows 24 pixels wider (making it look awful) and subsequent calls to this same code show that the value is now 294. Probing again, everything appears to be doing what it's supposed to (294 is read, the scaling factor is 1.00, the write value is 294) and again the legend grows by another 24 pixels. Same story for subsequent executions, every time i call this code another 24 pixels is added despite that never showing up in my code. An XY Chart in another tab on the same tab control has the exact same behavior (legend grows 24 pixels wider for every resizing).
So, I can fix this easily by adding a case statement to not execute this code if the scaling factor is 1.00, but it worries me that this isn't behaving correctly. Are there any settings that could be affecting this? Autosizing the legend is definitely turned off. I don't think it's another part of my code because it works beautifully for all other values I've tested. For the record, I'm running 32 bit Labview 2013 on Windows 7 with a 64 bit processor (Intel Core i7). Any ideas/thoughts are appreciated, I'm pretty thoroughly stumped and about to just add the case statement and live with the anxiety that my program is going to start adding 24 pixels in undesired places against my will...
Kevin
08-06-2015 09:14 PM
Can you attach your actual VI rather than just a picture of a portion of your code so that we can experiment with?