| Day | Gift | Published On | LabVIEW Gift |
|---|---|---|---|
| 5 | Gold Rings | Wednesday 12 December 2012 | UI Ring Control |
To commemorate the 5th day of Christmas, let’s make some gold rings! I’ve used a Text and Picture Ring Control, and formatted it as a type def to scroll through the 12 days of Christmas. (And maybe more…)

The focus of this VI was front panel modification. In order to create the ring control, I first placed a Text and Picture ring control down on the front panel (this can be done just as nicely with a picture control). Right-click the control and select Advanced->Customise and change the control mode to Type Def.

Items can be added by right-clicking the control and selecting Edit Items, as you would with an enum.

Most of the work goes in to formatting the pictures. To insert a picture onto your desired selection, copy it to clipboard (right-click and Copy), then right click the space for the image and select ‘Import from Clipboard’. Change to Customise mode and resize the control. You’ll find that resizing one instance of the control doesn’t resize all of the others, and you’ll have several background areas requiring resizing.
You may end up with something like this at first:

In order to get around this endless resizing, I formatted all the pictures to the same size (400x400 pixels in this case) and added each case (matched picture and text) at a time. On the Edit Items window, fill in 1 day of Christmas, then add the relevant image and resize, then add the second day etc. This removes the need for adjusting 12 image layers on the controller.
Creating the gold ring can be done either through property nodes or by using the tools palette. For this case, it seemed more straightforward to use the tools palette. To access this palette, go to View->Tools Palette. Select the colour boxes and change both the background and foreground colour to gold. The numeric code I used was 255:215:0. Then use the paintbrush to colour the control.
For the background, simply copy your desired image to the clipboard and paste onto the front panel. Use the ‘Reorder’ button to send the image to the background.

Overall, this was a simple introduction to customising user interfaces. Scroll through the list to see the 12 days of Christmas, and hit the Run button every once in a while for a Christmas surprise! (VI saved for LabVIEW version 2011 or later)
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.