LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
mrkvolf

Auto-populating of Case structure by Combo box

Status: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined. 

Hello,

I miss auto-populating of Case structure by Combo box. What about you? Smiley Wink

 

It works for Enum or Ring. But not Enum. Smiley Frustrated

 

ComboBox_autopopulate_Case_structure.png

14 Comments
AristosQueue (NI)
NI Employee (retired)

If the type of the wire changes so that it is carrying additional information, it becomes a language construct. I was looking at it from that point of view, but, you are correct, the feature as requested is just an editor feature.

mcmaxer
Member

A solution which can save you a lot of time if the Combo Box has a lot of entries.

Place a Text Ring on your panel.

Then place a Strings[] Property read for your Combo Box in your diagram, and route it to a Strings[] Property write for the Text Ring.

Run the code.

Go to your front panel and right click the Text Ring. Replace it with an Enum. Note that the string values are kept.

Go back to your panel, and connect the enum (labeled Text Ring 🙂 to a Case Selector.

Choose Add Case for Every Value.

 

Now you can delete the enum, and route your Combo Box to the Case Selector.

 

You can use this method for any String bound Case Selector, where you have an array of possible selections. It saves you a lot of time.

tst
Knight of NI Knight of NI
Knight of NI

If you're really doing this often and want to save time, you could also write a Quick Drop shortcut to do this which you invoke on the case structure. It would have to trace the input to the selector back to the control (assuming it is a combo box control) past tunnels, etc., and then get the list of values from the control and add missing cases to the structure.

 

Or you could automate the process you just described. Either way, not code I would want to write, but it could help you if you do this a lot.


___________________
Try to take over the world!
Darren
Proven Zealot
Status changed to: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined.