LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mutually exclusive combo boxes?!

Solved!
Go to solution
Highlighted

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
(495 Views)
Highlighted

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
(490 Views)
Highlighted

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
(474 Views)
Highlighted

Doesn't matter, the selection should be unique.

0 Kudos
Message 4 of 8
(463 Views)
Highlighted

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
Message 5 of 8
(438 Views)
Highlighted

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
(397 Views)
Highlighted
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
(390 Views)
Highlighted

@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
Message 8 of 8
(374 Views)