Replace and Paste-Replace

May 28th, 2011 by Christina in "Hidden" Features, LabVIEW, User Interface

There are multiple ways to replace things in your VIs. Knowing your different Replace options can help you choose the one that best fits your needs.

Replace Shortcut Menu

On the front panel, you can right-click on a control and choose one of the options from the Replace menu. This method will preserve some things about the original control. Unfortunately, it’s not obvious what things will be preserved. In most cases, LabVIEW will attempt to preserve the label, caption, value and dataflow direction (control/indicator). It may also try to preserve other things, such as the numeric representation, size or color. It’s hard to say what will be preserved without actually doing the replace.

Luckily, you have Undo if a right-click replace operation doesn’t do you what you want. But what do you try next?

Paste-Replace is a method of replacing a control without preserving any of its appearance attributes. It will, however, preserve things like connector pane placement, wire connection and associated block diagram elements (e.g. local variables and implicitly-linked Property/Method nodes). (By the way, right-click Replace preserves these things as well).

To use Paste-Replace:

  1. Place the control you want.
  2. Use Edit>>Cut (from the menu, or via keyboard shortcut) to put it on the clipboard.
  3. Select the control you want to replace.
  4. Use Edit>>Paste.

Note that Paste-Replace is not available when editing the LabVIEW block diagram. On diagrams, you almost always use right-click Replace. However, some structures (such as loops) have special Replace menu options to replace them with other structures without losing their contents.

I have to admit that, as a usability advocate, I’m not happy with the unpredictable nature of front panel Replace. Because LabVIEW is guessing which things you want to keep about the original control, it frequently appears to have an incorrect behavior when it’s actually working as designed.

For example:

  • You place a Push button on your VI and then realize you need an LED instead. If you Replace the button, you end up with an LED that’s a control instead of an indicator. This is particularly frustrating for new users who haven’t yet mastered the control/indicator concept, because it causes problems later when they’re wiring to the control.
  • You Replace a Classic Numeric with a Modern one and it doesn’t match Modern Numerics placed from the palette (because LabVIEW preserved the colors of the numeric text).Results of replacing a Classic Numeric with a Modern Numeric
  • You Replace a Classic String with a Modern one and the text is clipped (because LabVIEW preserved the overall height of the Classic control even though the Modern one has a bigger frame).Results of replacing a Classic String with a Modern Sring
  • LabVIEW does not always preserve the label of the replaced control. If the original control has the “default” name for its type, e.g. “Numeric,” then LabVIEW will not preserve its name after replace. This can be particularly confusing if the original control is a type definition, because the default name for the type is defined by the type def master control (and could be anything).

Unfortunately, there are good arguments for why Replace in LabVIEW works the way it does in other use cases, so it’s not something we can easily “fix.” The best solution I can offer at this point is knowing your options. If all else fails, you can delete the unwanted control and place a new one instead.


  • Yes, this problem puzzled me a lot.
    Paste-Replace is a great way.
    Thanks for sharing.

  • I love the “paste-replace” option. I discovered it a while ago and I find it specially useful when doing for example polymorphic VIs that require all the inputs and outputs to be on the same location in the connector pane.
    I can save one of the instances of the polymorphic VI as another name and then just paste-replace the actual controls I want to use and they are at right location in the connector pane. Just minor changes to the block diagram and I am ready.

    Thanks for giving a name to a feature that I love and explain it so well.

  • I echo your frustration with replacing buttons with LEDs. It would be nice if LV changed the dataflow direction.

    Using System controls and indicators alleviates some of the unexpected visual behavior here. System controls also provide an intuitive interface for end users and adapt to the native OS (e.g. XP, Vista, 7, OS X, etc.).

    Aside: To set System controls and indicators as default: Tools » Options » Front Panel » Control Style for New VIs

  • Cool Hack! I like this blog.


Comments have been closed for this post.