LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2d array to 1d array of combobox

Solved!
Go to solution

Hi, I have a question,

 

I have an array of combobox, I would like to populate every single comboboxes from one of the dimension from the 2d array.

I have tried with a cluster and it work. when I`m working with an 1D array, I do not have the option to iterate in every element inside since it is a 1D array.

 

thank you.

0 Kudos
Message 1 of 9
(5,813 Views)

So you want to put info into N diffierent comboboxes?

 

You need to use a For Loop.

0 Kudos
Message 2 of 9
(5,775 Views)

Not exactly, I want to populate and array which have undermined amount of comboboxes. Please see the attached image.

These comboboxes are changed depending on the 2D array created. Each combobox can be different. I have been able to implement this with clusters, I am afraid that it is not possible with array to have an array of comboboxes with different element inside of each.

 

Combo boxes are (sort of) an array of strings. and the user can select one of the strings. I don't think people iterate a for loop to populate a combobox, they usualy use their property node strings[], correct me if I am wrong, it is my first time coding in LABView.



Thank you.

 

0 Kudos
Message 3 of 9
(5,761 Views)

@bjaii wrote:

 

Combo boxes are (sort of) an array of strings. and the user can select one of the strings. I don't think people iterate a for loop to populate a combobox, they usualy use their property node strings[], correct me if I am wrong, it is my first time coding in LABView.

 


No.  It sounded like you want to iterate a whole group of comboboxes, based on an array of references you had.  (That is what your original image showed.)   In which case you would use a For Loop.   Now your new image is clearer in that  you are working with a 1-D array of combo boxes.

 


bjaii wrote:t. I have been able to implement this with clusters, I am afraid that it is not possible with array to have an array of comboboxes with different element inside of each.

 


Correct.  The strings that make up a combobox are a property of that combobox.  When you have an array, all elements of the array must have the same property.


Bjaii wrote: it is my first time coding in LABView.

 


Trying to work with arrays and clusters of comboboxes is a pretty ambitious way to start for your first time coding in LabVIEW.
0 Kudos
Message 4 of 9
(5,732 Views)

That is not possible.  All elements of an array have the same properties (except Value, Position, & Key Focus).  So in an array of combo boxes, every element must have the same set of strings.

 

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 9
(5,679 Views)
Solution
Accepted by topic author bjaii

@paul_cardinale wrote:

That is not possible.  All elements of an array have the same properties (except Value, Position, & Key Focus).  So in an array of combo boxes, every element must have the same set of strings. 


It is true what you said about arrays, but is not true that this isn't possible.  Here I posted an example where there is an array of clusters, with a combo box and a string.  The string is sorta like a filter and only shows combo box items that match that string.  So in this way it appears that multiple combo boxes have different drop down items, but really they just change as the user interacts with the combo box.

 

http://forums.ni.com/t5/LabVIEW/Edit-a-array-of-Cluster-element-property/m-p/2987577#M856978

Message 6 of 9
(5,674 Views)

I think I can do something with what you have here, thanks.

 

For my general culture, I dont understand how the property node Combo Box knows which Combo Box it is refering itself to? Are property nodes dynamics?

 

Is the first part (determine row based on mouse location) here to save some computing power to not recompute all items in array?

Would it have worked with "value changed" and re-compute all element in array? (again, for me general knowledge)

 

thanks.

0 Kudos
Message 7 of 9
(5,657 Views)

@bjaii wrote:

For my general culture, I dont understand how the property node Combo Box knows which Combo Box it is refering itself to? Are property nodes dynamics?


Property nodes work on a reference to the control.  So you give it a reference to a control and it knows to act on that control.  The reference can be implicit or explicity, meaning the reference can be tied to an actual control in which case you don't need to tell it what control to work with, or explicit, where you provide the refernce to the control to act on.  This can cause run-time errors if you don't provide a valid reference for that type.

 


@bjaii wrote:

 

Is the first part (determine row based on mouse location) here to save some computing power to not recompute all items in array?

Would it have worked with "value changed" and re-compute all element in array? (again, for me general knowledge).


Why would you need to know the coordinates of every index?  If there is a valid reason to have this information you can write a function that does that, but for this case we want to know one thing, where is the mouse?  And what did the user just try to do?  The other information isn't important, and I'm not sure why you would want to calculate information you don't need.  Maybe I'm misunderstanding you.

 

0 Kudos
Message 8 of 9
(5,650 Views)

Cool.

Here it is implemented as an xcontrol.

Currently doesn't handle resizing.

Also there's a race condition in there somewhere (that's why I have the error wired in the example).

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 9 of 9
(5,627 Views)