The size of the dialog is adjusted and saved manually, so that only what is intended to be seen is shown when the dialog appears. However, every time when a dialog is modified, the size may need to be adjusted again. To avoid the trouble of adjusting the front panel every time when a change is made, this recipe provides a way to size a dialog automatically.
To start building the VI to size a dialog automatically, we need to execute the following steps:
We open a new project and VI.
Create the block diagram as shown in the following screenshots. The six values contained in
enum
are Initialize, Find Max Height, Set Origin, Set Panel Bounds, Center FP, and Shutdown. The first state Initialize gets the VI reference for the front panel which we would like to autosize. The pane reference is obtained, assuming that there is only one pane on the front panel. The references for all the decorations on the front panels are obtained.Create the next case, "Find...