Example Code

A mockup GUI window using my Penta Panes Class.

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

    Operating System

  • Windows

    Programming Language

  • LabVIEW G

Description

This example Penta Panes Demo.vi is a mockup graphical user interface (GUI) window. it demonstrates the use of the "PentaPane" class (contained within Penta Panes.lvlibp). 

The PentaPane class was written to fullfill the following requirements: 

  • GUI window has to fit and be functional across multiple screen resolutions.

  • GUI window has resizable.

  • Certain GUI elements (like graphs) need to change size with the front panel, other elements needs to keep appropriate size and position. (trying to use LabVIEW's built-in solutions such as "Scale Object with pane" and "Scale Objects while resizing", didn't seem to be working well enough) 

  • GUI window needs to accomodate many actions, settings, parameters, calibration procedures, measurements, etc. This requires a lot of controls and indicators that needed to be placed in a way that keeps the FrontPanel uncluttered (so as to not intimidate users with a messy confusing interface), has a logical meaning (e.g. grouped by functionality) and is not wasteful of precious front panel area which is best used to view the actual data. at the same time it there has to be an easy way to access all needed functionalities. 

  • GUI needs to be able to contain hidden restricted areas accessible only to developers or certain users (e.g. debugging indicators, advanced users or accessing factory settings).

  • GUI needs to to be able to contain side by side view of several graphs, possibly of different types, for performing line profiles, comparisons, viewing multidimentional data etc. 

  • Intensity graph needs to be able to be resized while keeping the aspect ratio of the axes.

 

The way this class work is by handling the PentaPane window (a FrontPanel window composed of 5 panes created by 4 splitters) automatically. Giving the developer methods to (programmatically) open, close and resize panes, determine how each GUI element will behave when its pane is being resized. It also allows you to have multiple panes "instances" by placing them outside the visible area of the pane and then switching the pane origin to show them using SetPaneOriginToPaneInstance.vi .  

The purpose of using this class (or this demo as a template) is to have a GUI window with all the mechanisms of resizing controls and pane and splitters works already built-in, so the developer can go straight to working on the actual functionality of the software.

a few notes:

  • currently only this configuration of splitters is allowed (two horizontal and then two vertical in middle pane).

  • splitters can be any width however LabVIEW doesn't allow changing splitter width during runtime.

  • currently pane's scrollbars aren't allowed and should be set to invisible. In registered objects scrollbars are OK.   

I hope many of you will find this example useful and effort saving. 

 

How to Use

 

Running the Demo

  1. Unzip: PentaPanes Demo Project - LV2023.zip

  2. Open project: PentaPanes Demo.lvproj

  3. Run top-VI: Penta Panes Demo.vi 

 

In order to use the class in your GUI 

  1. Build an appropriate FP (two horizontal splitters and then in the middle pane two vertical splitters)

  2. Init the object using Init5Panes.vi

  3. Register controls and indicators objects using RegisterGUIObjectToResize.viNote: currently the supported objects for use in this class are 
    SubPanel, Path, String, Table, TreeControl, Array, GraphChart (and all child classes), TabControl, Boolean, Picture. 

  4. Automatically resize all objects in pane by adding ResizeObjectsinPane.vi to Pane Size events.

  5. Resize panes by using SetPaneSize.vi to close pane resize it to 0. 

  6. If you want to change the layout during runtime you may re-register objects (using RegisterGUIObjectToResize.vi with the same reference again).

  7. Shutdown the object before the FP closes using ShutDown5Panes.vi



Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
yoncoh@gmail.com
Member
Member
on

how come I can't edit my own post? 

 

it tells me: 

yoncoh@gmail.com does not have access to edit this message

 

odd. 

 

yoncoh@gmail.com
Member
Member
on