How to Programmatically Center Indicators on the Front PanelPrimary Software: LabVIEW Development Systems>>LabVIEW Professional Development SystemPrimary Software Version: 8.2.1 Primary Software Fixed Version: N/A Secondary Software: Utility Software>>Instrument I/O Assistant
Problem: How can I programmatically center an indicator in the front panel of LabVIEW? Solution: A Panel Bounds property node can be used to calculate the width and height of the front panel. To obtain this property: 1. Place a property node on the block diagram. 2. Right click on the top half of the property node and click on Select Class » VI Server » VI » VI. 3. Left click on the bottom half and select Front Panel Window » Panel Bounds. 4. Wire the output to an Unbundle by Name vi, and the result should look like figure 1 below. Figure 1
These four unbundled values can be used to calculate the width and height of the front panel. Using the bounds of an indicator, the position to center the indicator can be calculated and updated while the program is running. For example, consider centering a waveform graph as shown in figure 2 below. ![]() Figure 2
When this code is placed into a loop, the indicator will dynamically center itself on the front panel. The attached VI demonstrates this. Run this VI and resize the front panel while it is running.
Related Links: NI Community: Programatically Center Front Panel Object KnowledgeBase 3IF9AP0K:Error When Trying to Se the Front Panel Window Bounds Using a Property Node KnowledgeBase 3ELD8N4H: Programmatically Move Front Panel to Desired Position Attachments:
Report Date: 06/06/2007 Last Updated: 05/15/2009 Document ID: 4A5JUPCY |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

