How to use Name/Value pairs in dropdowns


A neat feature of Helm¬†dropdown is the ability to use name-value pairs. This let’s you set a more descriptive name for the value returned by a dropdown. Why would you want to do this? Well say you want 3 text size options 16pt, 24pt and 32pt. Instead of the dropdown showing the user the point size, it can read Small, Medium and Large. Much more friendly.

You can download the example panel here: Dropdown HowTo

Let’s see this in action

media_1364812086103.png

Here we’ve set up dropdowns to control the size and colour of the text item to the right. Now let’s look at the dropdown properties.

Dropdown properties

media_1364812358666.png

To set this up we did 3 things:

1 – Set the property NameValuePairs to true
2 – Double-click the Items property to edit the item list
3 – Create a list of items of the form <name>=<value>
4 – Create an OnChange script to control the size of the text item

OnChange script

media_1364812611576.png

A very simple script which sets the point size of the text item to the value of the dropdown.

Now another example – controlling colour

media_1364812773307.png

Here we’re controlling the colour of the text. Let’s see the dropdown properties.

Properties

media_1364812871678.png

Here the item list uses the Helm colour name constants instead of numeric values.

So that’s how it’s done.

Name – Value pairs give you a way to create interfaces that are easier for your operators to use and understand.

Tagged with: ,
Posted in HELM, Visual Controls