Showing and Hiding Decorations Programmatically

Jul 10th, 2010 by Christina in LabVIEW, User Interface

Grouping with Recessed Frames

When laying out a panel, you sometimes want to “group” elements together. You can do this by leaving a little empty space around the group. In some cases, however, it’s better to use a decoration such as the Recessed Frame, especially if you want to label the group.

Unfortunately, if you need to show/hide (or move) the group programmatically, you’ll find that you can’t get VI server properties for a decoration like you can for a control.

There are numerous techniques for showing and hiding decorations programmatically. I’ll go over four of them here.

Use an Invisible Tab Control

Tab controls can be very handy for showing and hiding groups of controls and decorations. Instead of writing the “Visible?” property to a set of controls, you just change the visible tab of the tab control (by setting the value of the tab control). This technique also makes it easy to have multiple sets of controls occupy the same space.

The trick is just making the tab control invisible in the final panel. To do that, use the tab control from the Classic palette, hide the tabs and color it transparent.

Watch a video on YouTube or QuickTime. Download an example VI.

Use a Background Button

For a general-purpose way of making an image or other decoration that you can work with like a control, use a button. I recommend you use the Flat Square Button from the Classic Boolean palette. First, get the image or decoration on the clipboard. If it’s an image in a file, use Edit>>Import Picture to Clipboard. If it’s a decoration from the palette, place it on a panel, select it and copy (or cut) it. Then edit the button in the Control Editor, right-click on it and Import Picture from Clipboard. I recommend you customize the False image first. In some cases, you can easily switch between two images by using a different image for the True state.

Watch a video on YouTube or QuickTime. Download an example VI.

Add the Frame Decoration to a Control

Using the Control Editor, you can customize the control and add the frame decoration. Then when you show and hide the control, the frame decoration shows and hides as well.

Watch a video on YouTube or QuickTime. Download an example VI.

Use a Cluster

I don’t consider this a good option, but it is the most obvious one. You can use a cluster for your grouping and change the frame appearance in the control editor if desired. The problem with this is that clusters are more of a data bundling element than a user interface element. You lose the individual control data terminals on the diagram. You also have to do extra navigation to tab to the controls in the cluster to give them key focus.


  • You can also name the decoration.

    Well, sort of. See here for an example:

    Personally, I usually prefer the tab method.

  • Rick Beauchaine

    Hi Christina

    As Yair alluded to, the decorations don’t have a real label to assign the reference to, so unless you know which ref goes with which dec you can’t treat them like other objects (Also the all objects property is only for the panel..).

    Decorations seem to have a label property, and the entry box is enabled, but the entry does not seem to stick. it would be great if we could assign a label like on other objects and use that to get the ref..

    Thanks for the other suggestions, Rick

  • Yair – Thanks for the link! That’s an interesting use of VI Scripting! I, too, prefer the tab method to show/hide groups of controls. I use a customized button whenever I need an icon or other image.

    Rick – Yes, it’s not that you can’t get references to decorations, it’s just that it’s not as straight-forward as references to (and properties for) controls. I think the label property showing up in the decoration’s Properties dialog is a bug; decorations don’t currently have storage for a label, although I agree it would be useful.

    However, as Yair pointed out, it is possible to “tag” objects in LabVIEW using VI Scripting, which does let you manage them by name, sort of.

    Also, with VI Scripting, you can get references to the decorations on the diagram. Though I’m a little curious what you need those references for, unless you’re generating VIs programmatically.

  • I am trying to “Underline” by button text on “Button Move Event”..!
    Can someone help me with this pls.!?


Comments have been closed for this post.