How to set the Strings[4] property individually on Boolean controls in a cluster

Many control properties can be used freely regardless of whether the control is in a cluster, even if the cluster is a typedef or strict typedef

Unfortunately the Strings[4] property is not one of these. This property allows you to set a different button text for each of the four possible states 1 of the control

The interaction of the Strings[4] property and the containing cluster is a little complicated, so I’ve laid it out in a table below

ClusterTypdef ClusterStrict Typedef Cluster
Multiple Text String appears in right-click menuNoOnly in Typedef editorOnly in Typedef editor
Multiple Strings setting in properties dialogYesYesOnly in Typedef editor
Multiple Strings setting propogates to instancesN/ANoYes
Accepts Strings[4] propertyYes – works as expectedYes – but only first elementYes – but has no effect

The Properties pop-up menu appears when you right-click on the control on the Front Panel. It’s only available if you can select the control, so it doesn’t work on a control defined by a strict typedef

Multiple Text Strings pop-up menu
Pop-up menu for Boolean control showing Multiple Text Strings property

As outlined in the table above, neither of the typedef’d options allow you to set different strings for all four states. This code demonstrates the problem

Buttons.vi snippet showing multiple text strings not being displayed as expected
Example VI which can’t set all four Boolean text strings

Luckily, there is a simple solution. Turning on VI Scripting2 will enable a number of new properties on the Boolean control, including Multiple Text String. Setting this property to True will allows the Strings[4] property to work as expected

Buttons with Scripting.vi snippet showing multiple text strings showing as expected with scripting node
Example VI with all four Boolean text strings working

Subscribe to our newsletter

Did you find this post helpful? Sign up to the Lonely Ant newsletter to get more useful tips delivered directly to your mailbox

Unsubscribe at any time. I will not share your information with third parties.

* indicates required
  1. False, True, False with Mouse Down, True with Mouse Down
  2. VI Scripting can be turned in the VI Server section of the Options dialog found under the Tools menu in LabVIEW