From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Separate window size questions

Hello,

 

I'm using LabView NXG 3.1.1 and I've noticed that when running a VI in a separate window instead of the editor, the window that opens up is enormous.  I can manually resize it by going to the Panel tab and entering in my screen's resolution in the width and height boxes in the 'Canvas' section. 

 

However, the program I'm working on will likely be run on multiple machines with potentially different screen resolutions.  How do I ensure that when the program opens up in a separate window, the window will be the correct size every time?

0 Kudos
Message 1 of 6
(2,358 Views)

Hi gabe57,

 

There is a way to programmatically set the window size, but not to read the resolution of the new screens. Would that be sufficient?

 

Best,

Claire C.
AppSW Staff Product Support Engineer
National Instruments
CLD|CTD
0 Kudos
Message 2 of 6
(2,275 Views)

Ok,

 

So there is no way to get the resolution of the current screen?

 

In order to set the window size, it looks like it can be done by creating a panel reference and inserting a property node for the window size.  Is that the right way to do it?

 

Thanks,

Gabe

0 Kudos
Message 3 of 6
(2,261 Views)

Hi Gabe,

 

That's correct, that's how you would do that.

 

As for getting screen resolution, LabVIEW NXG doesn't support this natively. There may be some workarounds to get it, including using the VI Interop node to call into LabVIEW, but the best solution for you depends on many other factors.

 

Best,

Claire C.
AppSW Staff Product Support Engineer
National Instruments
CLD|CTD
Message 4 of 6
(2,251 Views)

Not sure if .net works in NXG, but look at method 3 of this post

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
Message 5 of 6
(2,242 Views)

Hi gabe57,

 

You can programmatically resize the panel using both of the above suggestions. See the below images and the attached example project. You can use the .NET Interface to call the System.Windows.Forms assembly and use the Screen object per that other post. 

 

Frozen.NET does in fact work with LabVIEW NXG (NXG is built in .NET). See Calling .NET Code from Your Application for more info. 

 

Project with DNI.pngGet Screen Size.pngResize Panel.png

 

Thanks,
Frank

0 Kudos
Message 6 of 6
(2,220 Views)