LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Subpanel size + position madness

Hello there,

 

I struggle with a pixel accurate alignment of subpanels. I have SubVI_A with a front panel of 200x200 pixels. I also have SubVI_B which should display SubVI_A in a subpanel right at the coordinates 0,0

 

What I have found is (and this is weird on its own) that I need to size my subpanel to 206x206 to display everything. Then I thought its the frame of the subpanel. If I needed to increase both X and Y size by 6px then probably the frame is 3px. So then I thought I need to position my subpanel to -3,-3. But this also doesnt seem to be true. It seems that I really need a 206x206 panel but positioned to 0,0. If I put it even to -1,-1 the first row and column of pixels seems really be at -1,-1.

 

There must be a golden rule of how to position subpanel, please let me know what it is as it seems that I really dont understand this topic.

 

I have attached the VIs. Note that the grid size is 10px instead of the default 12px, so 200px can be measured easier.

 

Thx!

Download All
0 Kudos
Message 1 of 5
(760 Views)

Hello 1984,

 

Subpanels have a frame thickness of 3 pixels, which offsets by the same amount the display of the contained panel.

So in order to fit a W*H panel, the Subpanel must have a size of (W+6)*(H+6). In your case 206*206.

If you want to display the contained panel at position (X, Y), the Subpanel must be positioned at (X-3, Y-3). In your case (-3, -3).

 

Check the VIs attached.

 

Regards,

raphschru.

Download All
Message 2 of 5
(747 Views)

If you want to display the contained panel at position (X, Y), the Subpanel must be positioned at (X-3, Y-3). In your case (-3, -3).

 


This is what I have thought, and it could be right, but what I see is still very confusing. If in my SubVI_B you move the subpanel to -1,-1 then you'll see that the white background of SubVI_A goes above and to the left of the reference lines which intersect at 0,0. And suggests the stupid idea that the subpanel has a 0px wide frames on the top and the left and a 6px wide frame on the bottom and the right.

 

Again, I believe you are right with 3px uniform frame width, but I can't explain what I see by assuming a 3px wide frame. See  a screenshot about my original VI if the subpanel is at -1,-1

1984_0-1675177292242.png 

1984_1-1675177351394.png

 

 

0 Kudos
Message 3 of 5
(731 Views)

Well, it seems you have found a new bug.

 

The Position property seems to be broken when the frame is not visible, which puts the Subpanel in a kind of "inconsistent" state.

 

As a workaround:
1. Set the Subpanels's frame visible.

2. Adjust its position via the property dialog and validate (you may have to do it twice to clear the "inconsistent" state of the Subpanel).

3. Set it back to invisible.

Message 4 of 5
(719 Views)

To make it further confusing:

  1. I see that in your subvi_A you have a frame surrounding white background
  2. In you subvi_B you moved the subpanel to -3,-3 and it seems that the frame of your subVI_A and the reference lines in subVI-B are perfectly aligned.

 

Looks great! Now go to subvi-A and delete the frame, save the VI, run subVI-b and you'll see that the white background is still perfectly aligned! Awesome!

 

Now whats not gonna be that awesome is this:

  1. Try moving the subpanel to 0,0 from the properties
  2. on my PC its immediately visible that the subpanel did not move to 0,0. On mine it moved to 3,0
  3. Now try moving it again, at this time it really moves to 0,0
  4. Run subVI-B and you'll see that the background is still perfectly aligned
  5. Now move back the subpanel to -3,-3 and you'll see that the background is off by 3px

 

I'm really wondering if this behaviour is reproducible on other PCs, because looks very odd.

0 Kudos
Message 5 of 5
(700 Views)