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,833 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,819 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

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 3 of 8
(1,812 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,793 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,751 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,733 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,729 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,721 Views)