From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Mutually exclusive combo boxes?!

Solved!
Go to solution

Hi,

 

Please excuse my silly question, absolute beginner here.

How can I make sort of 'mutually exclusive' combo boxes (not sure if that is a real thing)?

Something like this; when I select Item 1 in first box, it is grayed out in second box and I can only choose the remaining item?

 

Capture1.png

 

Thank you.

 

0 Kudos
Message 1 of 8
(2,556 Views)

You'll need to work with the event structure so that the value change of one box causes the other box to change its choice of selections.

 

This can be tricky.  What happens if someone selects from the second box first?

0 Kudos
Message 2 of 8
(2,551 Views)

I remember, but sadly can't find at the moment*, a blog post about a case study about a few thousands of such combo-box-like elements being necessary for a project. Just saving the list of strings for each of them would have been a significant memory drain.

 

The solution was to generate the Strings[] array on the fly whenever one of the controls was clicked. On a value change, the array was then purged again, with the selected string remaining on display.

 

You could probably make an FGV holding the Strings[] and for each String some sort of counter if, or reference where, it is already used.

 

[*]I would be glad to know if anyone remembers the source for this. That blog had some nice design ideas.

0 Kudos
Message 3 of 8
(2,535 Views)

Doesn't matter, the selection should be unique.

0 Kudos
Message 4 of 8
(2,524 Views)

As already stated, you will need to use an Event Structure.  I would have an event case for each combobox's Value Change.  So when one value changes, you take that new value, remove it from the original list of possible values, and update the Strings[] property for the other cobobox.


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 5 of 8
(2,499 Views)

Like Crossrulz said, I have them inside event and can see the NewVal but how do I remove it from the original set of values? By array-subset function? If so how do I get the  index value for susetting?

 

I am also not sure how to update the Strings[] property of next combo.

 

 

0 Kudos
Message 6 of 8
(2,458 Views)
Solution
Accepted by topic author dsan

@dsan wrote:

Like Crossrulz said, I have them inside event and can see the NewVal but how do I remove it from the original set of values? By array-subset function? If so how do I get the  index value for susetting?

 

I am also not sure how to update the Strings[] property of next combo.

 

 


You can't disable individual items in a combo box.  But you can do something similar with text rings.

See attachment

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 7 of 8
(2,451 Views)

@dsan wrote:

By array-subset function? If so how do I get the  index value for substring?


Use Search 1D Array to find the index and then Delete From Array to remove that item.


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
(2,435 Views)