LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically populating or showing/ hiding options in enum or ring control

Solved!
Go to solution

Hey guys,

So my problem is that I have a list of known selections that I would like in something like an enum or ring control, the user will have to click on one option and something will happen unique to each selection. the program will have many pages where the enum/ring will be present and on each page the options available will be a relatively unique grouping of the known values.

 

basically options 1 - 6 are already known to exist.

on page 1 the drop down shows options 1, 2, 3

on page 2 the drop down shows options 2, 4, 5,  6

....

 

every page will have some combination of the options.

 

also this isnt random, im pulling the page and the list of items for the list from a database.

 

Im trying to think of a good way to do this, my guess is my options are rings or enums but if theres something else I could use to generate lists like this at run time I have no problem looking into it. I was looking into using the strings property node to take the strings of options from the database and populating the ring control but how do I keep the value of the ring always associated with the proper string? I could use the value and string property and just pre associate the database strings with the proper numeric value.

 

I'm just wondering if there's a better way to go about this.

 

Thanks for any help

0 Kudos
Message 1 of 8
(4,373 Views)
Solution
Accepted by topic author pathare535

I would use a Ring since you need to change the list dynamically.  Then you can use the StringsAndValues[] property for each one to populate their individual list.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 8
(4,370 Views)

Yeah thats pretty much what I was thinking I would have to do, just looking to see if anyone had a fancy alternative.

 

Thanks though

0 Kudos
Message 3 of 8
(4,366 Views)

I also believe TextRing is the answer.

I made a little program comparing TextRing, MenuRing, Enum & Combobox.

The TextRing looks OK to me. The others are either silly or cannot be used like the ENUM

(Why is the ENUM different? Though it looks te same as the TextRing)

0 Kudos
Message 4 of 8
(3,996 Views)

@LV_Warrior wrote:

...

(Why is the ENUM different? Though it looks te same as the TextRing)


Go to the block diagram, turn on the help window, switch to the wiring tool, float over th enum wire and observe....

 

The enum has string values in the wire.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 8
(3,991 Views)

Indeed. That is a difference.

But what I find more intreaging is that the Enum does not allow setting the strings using a property node while the Textring does.

Is the logic behind this that the Enum has "strings IN THE WIRE" ?`

0 Kudos
Message 6 of 8
(3,950 Views)

Yes.

0 Kudos
Message 7 of 8
(3,938 Views)

LV_Warrior wrote:Is the logic behind this that the Enum has "strings IN THE WIRE" ?`

For an Enum, the strings are set at development time.  This allows for things like showing the string in the case structure.

 

A Ring is equivalent to an enum except its strings are set at run time.  This means you can update the strings on the fly, but you lose some programming self-documentation.

 

A combo-box is just like a ring, except the data type is a string instead of a numeric.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 8
(3,930 Views)