LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to centre an image within tab control on front panel in LabVIEW 10 (Mac Version)?

Solved!
Go to solution

Hello,

 

I would like to centre an image on the front panel. The image is on a tab control that is fit to the pane. I can't seem to find a way. I'm working with LabVIEW 10 on a Mac. Any suggestions would very much be appreciated.


Thanks,

Michelle

0 Kudos
Message 1 of 8
(3,888 Views)

Hi,

 

you can drag on the corners of the image to resize. If you attach your vi we can help you better.

0 Kudos
Message 2 of 8
(3,884 Views)

Thanks Gita_A. 

 

I have attached the relevant part of my program. It's not to do with the size but position of the image - I would like the image to be right in the centre of the tab control. 

 

 

0 Kudos
Message 3 of 8
(3,872 Views)

Hi Michmar,

 

use property nodes to read the size of the tab control.

Then calculate the new position of your pic indicator and move it also using it's property nodes...

Should be possible on MAC the same way like on Win-PC!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 8
(3,869 Views)

The property nodes do work on the Mac.  I do not have time now to sort out which ones you need and the exact algorithm, but you can work that out with some experimentation and reading of the help files.

 

Lynn

0 Kudos
Message 5 of 8
(3,859 Views)

Thanks everyone. I now have property nodes for the tab control (Left: -1939, Top: -6468) and I can move the pic indicator by changing it's property nodes. This may be a stupid question but how do I figure out what numbers to set to the pic's indicator property nodes so that it is exactly in the middle?

0 Kudos
Message 6 of 8
(3,844 Views)
Solution
Accepted by Michmar

You will need to do some math.  Get the locations of the edges of the tab control and of the picture control.  The centers are at half the difference plus the top or left.  I am not sure without checking but I think the values are with respect to the corner of the display.  Be careful about the origin if you have multiple displays.  If the differences are odd, you have a half pixel error.  From the positions of the centers, you need to work back to the positions for the top and left edges.  It may take some experimentation.  The Bounds rectangle includes the label (I think), so keep that in mind also.

 

Lynn

Message 7 of 8
(3,829 Views)

Thanks everyone! Finally sorted it out. Very helpful!

0 Kudos
Message 8 of 8
(3,803 Views)