How to Set Up 'Arrange VI Window' for an Orderly Project

Nowadays at work I get to use LabVIEW 2020, which has some great inbuilt shortcuts. One of these is 'Arrange VI Window'.

Arrange VI Window was added into LabVIEW 2019, but can be downloaded for earlier LabVIEW versions here. The default QuickDrop shortcut is Ctrl + Space, Ctrl + F. It does many things apart from arranging the windows - moving the origin to (0,0), aligning controls on the front panel to match the connector pane ('clean up front panel'), and resizing the windows to fit the code or as much code as possible with a small border. These are all great. But I was after something in particular that it didn't seem to provide.

I had been working on a module with some repetitive code - think lots of similar subVIs with different inputs and outputs. The repetitive VI had a VI Template to keep things neat, but I found sometimes I accidentally moved one of the windows and it really annoyed me that they didn't all line up any more. Moving a window a few pixels at a time is not fun.

Arrange VI Window sounded like a perfect solution, but it didn't do what I wanted out of the box. I had imagined that it would position the VI Front Panel and Block Diagram side by side, not in an ugly tiled 'Ctrl + T' way with it split down the middle, but with the windows resized to their minimum size with a border around them. However, instead I found that the windows overlapped. I have big monitors which usually provides adequate space for both Front Panel and Block Diagram to be fully shown, so I wanted to avoid overlap if possible.

We learn the Ctrl+T shortcut then we erase it from our brains. So much whitespace!

Default settings for Arrange VI Window: not what I wanted



Luckily, the developer had allowed much of the shortcut behaviour to be customised with ini keys for the labview.ini file. Thank you Kosta! These ini keys are documented in a table here.


The values I ended up adding to my ini file were:

  • ArrangeVIWin.BD.LeftGap = 700 
  • ArrangeVIWin.FP.LeftGap = 0
  • ArrangeVIWin.FP.TopGap = 0
  • ArrangeVIWin.BD.TopGap = 0
This will mean that the top left of your Block Diagram will be at (700,0), and it will tile nicely with the Front Panel if your Front Panel is <700 wide. I could have gone down the route of editing the code to make the Block Diagram edge always touch the edge of the front panel, but the Front Panel would have to be resized first, and it wouldn't necessarily be neat if all the front panels were different sizes.


Arrange VI Window with some ini keys applied


Optionally, you can also change some settings that to my eyes make it nicer by putting a bigger blank border around the Block Diagram and setting a minimum width on the Front Panel so it will meet the edge of the Block Diagram. 
  • ArrangeVIWin.FP.MinWindowWidth = 715
  • ArrangeVIWin.FP.MinWindowHeight = 300
  • ArrangeVIWin.BDCanvasMargin = 30

Arrange VI Window with these extra ini keys


Lastly I made sure that the monitor I wanted my code to be on was my default monitor (I have 3), as Arrange VI Windows will arrange the windows on this particular monitor. This makes life much easier when screensharing - no more dragging over VIs that opened on the wrong screen! If I worked with LabVIEW developers who had smaller screens, I could also set VIWin.DisplayWorkspaceRight and VIWin.DisplayWorkspaceBottom to match their screensize.

Hope this helps you keep your projects neat. Let me know in the comments if you have any more tips.

Comments

  1. I ended up doing a talk on QuickDrop which covered this topic: you can find it at https://www.youtube.com/watch?v=TbfEZv_zTSw&t=1775s

    ReplyDelete

Post a Comment