From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically changing ring values

Solved!
Go to solution

Hello

 

I'm trying to create my own "menu". 

In the config file from which i'm reading there'll be a section with commands and their values. What i want to do is populate a ring (or something else more appropriate)  with names of commands and their values for example:

command: speed, value: 0x4E (or in decimal 78)

 

I managed to change the names with property node but the values elude me. What is the proper way to do this?

 

Also each time the config file is read, the old values should be purged from the list and new ones added.

0 Kudos
Message 1 of 8
(1,123 Views)

Hi Soul,

 

rings have a property named "strings and values"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(1,109 Views)

<edit> Oops, too late -- queued up a bunch of tabs, then it took a while to getting back to them.

-------------------

In addition to the Strings[] property (which you seem to be using), there's also a "Strings and Values[]" property node that let's you set or query them as an array of clusters...

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 3 of 8
(1,102 Views)
Solution
Accepted by topic author AeroSoul

Menu Ring.png

 

Note that his doesn't work with an enum control. Enum's look like rings, but there items are part of the type, and can't be changed when the control is running.

Message 4 of 8
(1,083 Views)

You could use a Ring or String combo for the UI Control, and a map to store the actual value. Nice thing about the String combo is that its value is the string, not just a number.

0 Kudos
Message 5 of 8
(1,041 Views)

uh, duh.. didn't see it all the way at the bottom... Thanks

 

Is there any way to select a "default" value (the one that shows as selected)? Currently it just displays <0> until i select something by hand.

0 Kudos
Message 6 of 8
(1,023 Views)

You can right-click on any control -> Data Operations-> Set Default (something like that). Or you can use a local variable to initialize it.

0 Kudos
Message 7 of 8
(1,019 Views)

Played around a bit and you can set the value to display programmatically by using Property Node --> Value and wire one of the values you input to StringsAndValues[].

 

Quick demo:

AeroSoul_0-1645603436264.png

 

0 Kudos
Message 8 of 8
(1,011 Views)