05-02-2012 12:22 PM
Yuck. I hate it when I run into dead weight caused by backward-compatibility.
05-02-2012 12:23 PM
Actually, I've been working yesterday evening and this morning on a Visio document containing a lot of these properties. Let me finish the current page and export a PDF for you. I think it (or something like it) would make a great addition to the LV Help in 2012.1 or 2013.
Update: Here it is: https://decibel.ni.com/content/docs/DOC-22385
05-09-2012 05:14 PM
I'm going to put a little extra info here for people who are confused about coordinate system transformations and looking to learn more about them. I will probably adapt this content to a post on the Eyes on VIs blog, and maybe we can someday get it into a form that would work in the LabVIEW Help.
In the illustration above, all the values are in Pane Coordinates. That means they are in the same coordinate system, using the same (0, 0) point and units. (Actually, all the LabVIEW coordinate systems I'm talking about here use the same units, so we can ignore scaling when doing coordinate transformations and only talk about translation - yay!).
[Note that the Active Cell Position is not actually the "offset from the corner of the table" as the OP's VI stated. Adding the table's position to this value is nonsensical and only worked for the OP because his table happened to be positioned at (0, 0)].
Here is an illustration of values that are in Panel Coordinates. The (0, 0) is the top-left corner of the panel.
[Note that the scrollbars get a little confusing - sometimes they're inside bounds and sometimes they're not and I'm not going to try to explain it all here].
The OP was doing a coordinate system transformation by adding offsets, which can work when the scaling is the same between the coordinate systems so the transformation reduces to a translation. However, he missed an offset: the (0, 0) point of the pane coordinate system to the corner of the pane's master rect bounds. This only worked for him because his (0, 0) happened to be in the corner.
Finally, here are values in Global Screen Coordinates, where the (0, 0) point is in the corner of the primary monitor:
In general, it is good practice to get all your position information into the same coordinate system before doing other operations. Otherwise it is easy to make logical errors. For example, you might subtract one control's position from another's position to get the distance they are apart, and it might seem to work. But if the controls are on different panes, and you then scroll one of the panes, the VI will suddenly start behaving incorrectly.
Rather than adding offsets, I recommend using the "Convert Pane to Panel Coordinates" (and similar) methods. They will reduce the complexity of your logic and make it more likely that you have a VI that works correctly in all situations.
12-30-2021 02:36 PM
Hi Christina,
You said "I will probably adapt this content to a post on the Eyes on VIs blog." I looked over there and did not spot anything. Did it ever happen?
Thanks!
10-12-2023 02:14 AM - edited 10-12-2023 02:26 AM
Hi everyone,
I had the same kind of problem with positionning a new window refering to the position of a control on a frontpanel (multipane FP), and the solution of Christina_R worked well, so thank you!
But actually, the solution works when the VI is launched and displayed on itself, but when inserted into a subpanel, the coordinates are wrong. Do you know if there is any trick to handle the fact that the vi is embedded in a subpanel?
thank you