LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The top of my panes are shifted up

I have a front panel with multiple panes separated by splitters. The VI was working fine, but parts of the code stopped working. I looked at the rectangles of my panes, and they are all shifted up. The pane looks fine since they are all shifted up the same amount so the relative distance is ok, but it does cause problems in other parts of my code.

 

Below is an image of an indicator showing the Master Rectangles and Origins of my panes. The left and right are fine, but the top and bottom are off. If you look at the first element the top of it is -230. The pane directly below that one has a top position of -190. I thought I somehow changed the origin of the VI. But I can't find that property anywhere since origins are pane specific. So in the image I show that all of the origins are (0,0). What could have caused my panes to shift down -230 pixels? Is there a property I missed?

 

Rectangles and Origins.png

 

0 Kudos
Message 1 of 10
(2,697 Views)
0 Kudos
Message 2 of 10
(2,650 Views)

My problem wasn't positioning front panel controls, but the position of the pane itself. The highest pane on my front panel was reading a top position fo ~ -230. I couldn't figure out why. In the end since I had this code in source control, I just rolled back to before the problem occurred. So the problem is gone now, but I don't know what caused it. I did .zip up the project before I rolled it back, in case there were any suggestions from the discussion board about how to fix it.

 

Larry

0 Kudos
Message 3 of 10
(2,646 Views)

Hi Larry,

 

Maybe I did not understand the question. Do you mean the position of the whole Front Panel?

 

In this case, this would work for you:

 

http://digital.ni.com/public.nsf/allkb/65C5C5B1D82EAD1486256F350069C973

 

If not, please let me know

Thanks

0 Kudos
Message 4 of 10
(2,636 Views)

This problem is a bit hard to explain. The array shown above was produced using this block diagram

 

Rectangles Origins Block Diagram.png

 

The link you posted above explains how to move a front panel. My problem is that the panes on my front panel have coordinates below zero. They look fine since they are all shifted the same amount, but this introduced bugs into other parts of my code where I needed to know the absolute total rectangle of my panes.

0 Kudos
Message 5 of 10
(2,630 Views)

Here I found How Can I Determine the Position of a Control in Screen Coordinates?

 

http://digital.ni.com/public.nsf/allkb/084B09DCABB66FD586256E21004F6458

 

And here you see how to Converting screen coordinates to LabVIEW pane coordinates

 

http://forums.ni.com/t5/LabVIEW/Converting-screen-coordinates-to-LabVIEW-pane-coordinates/m-p/121555...

 

However, there might be some errors: http://lavag.org/topic/7537-convert-panel-to-screen-coordinates-method/

 

Try it and tell me how goes

 

Thank you

0 Kudos
Message 6 of 10
(2,610 Views)

My problem isn't with the coordinate system. The Total Rectangle property node gives you the coordinates in the VIs coordinate system which is what I need. It just seems to give me the wrong Top/Bottom values. The Left/Right values are fine.

0 Kudos
Message 7 of 10
(2,594 Views)

I think you can work with the example code in the first link I sent you in the last reply:

 

I made a test taking the window from top to the bottom of my desktop, running the VI three times and I see it works fine so maybe this code may be helpful for you.

 

 

0 Kudos
Message 8 of 10
(2,579 Views)

Thanks for the help.


I ended up rolling back my code to a time before the error occurred. To keep this bug from effecting my code, whenever I needed to know the coordinates of a panel in the front pane's coordinate system I would use the property node of that pane to get the total rectangle and subtract off the offset that the top-most panel has. It is working fine now. But my question wasn't how to transform one coordinate system to another but what caused my panels' property nodes to return a total rectangle that seems to be shifted upwards, how could I have fixed that without rolling back the code, and what did I do to do that in the first place?

 

Larry

0 Kudos
Message 9 of 10
(2,555 Views)

Yes, subtracting is the way we do it in this example: http://digital.ni.com/public.nsf/allkb/084B09DCABB66FD586256E21004F6458

They use the left and top points as reference. It is similar but I understnad it is not exactly what you wanted in the frist place

0 Kudos
Message 10 of 10
(2,545 Views)