02-27-2016 06:12 PM
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.
Solved! Go to Solution.
02-27-2016 07:24 PM
So you want to put info into N diffierent comboboxes?
You need to use a For Loop.
02-27-2016 07:42 PM
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.
02-27-2016 10:42 PM
@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.
Trying to work with arrays and clusters of comboboxes is a pretty ambitious way to start for your first time coding in LabVIEW.
Bjaii wrote: it is my first time coding in LABView.
02-29-2016 10:32 AM
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.
02-29-2016 10:41 AM
@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
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
02-29-2016 10:55 AM
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.
02-29-2016 11:13 AM - edited 02-29-2016 11:14 AM
@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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
02-29-2016 05:12 PM
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).