Daryl Posted March 15, 2011 Report Share Posted March 15, 2011 (edited) I have array of clusters. The clusters have 2 elements - 1 string and 1 combo box. Can I populate the combo box programmaticly? How? Edited March 15, 2011 by Daryl Quote Link to comment
pylb Posted March 15, 2011 Report Share Posted March 15, 2011 You can use references to the array element and navigate up to the list box. Quote Link to comment
Ryan Podsim Posted March 15, 2011 Report Share Posted March 15, 2011 As PYLB posted, you can but all array elements will have the same Item names for the listbox. To my knowledge all array elements must have the same properties outside of there value. I don't think it's possible to have listboxes with different items. Quote Link to comment
pylb Posted March 15, 2011 Report Share Posted March 15, 2011 of course, don't forget to close all the references at the end Quote Link to comment
Daryl Posted March 15, 2011 Author Report Share Posted March 15, 2011 You can use references to the array element and navigate up to the list box. Sweet, i was soooooo close of course, don't forget to close all the references at the end Thanks for the help. Quote Link to comment
skilledengineer Posted March 15, 2011 Report Share Posted March 15, 2011 Hi Daryl, Define your own Item values using Index Array function. George Quote Link to comment
Dorschty Posted February 27, 2013 Report Share Posted February 27, 2013 Hi,I`m new here and I want to sorry first for my english^^I have a similar problem as Daryl before. I have an array of cluster. The cluster is a Typedef with one string, two numerics, a boolean and a combo box.The entries for the array I get from an .ini file. Every line of the array is filled with different values, so also the Combo boxes have to be filled with different values.I have tried the example above, but where the "to more specific class" VI with ListBox connected is, I become an error with: Possible reason(s):LabVIEW: Type mismatch: Object cannot be cast to the specified type.I don`t know, what I do wrong. The index of controls[] array is the right one. Quote Link to comment
Dorschty Posted February 27, 2013 Report Share Posted February 27, 2013 I have an array of cluster like shon in the picture. Then I made a subVI, which is called for every line of the array. So in the SubVI I read out my .ini file and so on. This SubVI is called as often, as lines or elements are displayed in my Array on the FrontPanel, because I enter only one line per call of this VI... I hope you can understand what I mean. What I also already tried is to make a reference on "Element" of my SubVI and then go the way over controls[] and so on, but this also didn`t work. I hope somebody can help me. Here is the array of clusters Here is the array of cluster Quote Link to comment
Dorschty Posted February 27, 2013 Report Share Posted February 27, 2013 Ok, Here is the part, that doesn`t really work.The Main and the SubVI is shown here. What I want is to fill the Array in the Main VI with the items of the SubVI. Here is the Main VI Quote Link to comment
Dorschty Posted February 27, 2013 Report Share Posted February 27, 2013 Here is the main and the SubVI. Main VI: Main VI: SubVI.vi MainVI.vi Quote Link to comment
Dorschty Posted February 28, 2013 Report Share Posted February 28, 2013 Oh, I`m sorry. Here it is.I think the problem is not to write into the combo box. I think the main issue is to have different values in every combo box of the array. I don`t know if this is possible.Thank you for your time and help so far.It would be great if you could have a look at it at the weekend. Cluster.ctl Quote Link to comment
ned Posted February 28, 2013 Report Share Posted February 28, 2013 The controls in every element of the array need to be identical; you cannot have a different items in the combobox in different elements of the array. You'll need to come up with some other approach. One option might be a table indicator with a combobox on top of the active cell, which would let you change the contents of the combobox each time you display it in a new location. I provided some code that demonstrates the idea here: http://forums.ni.com/t5/LabVIEW/array-of-cluster/m-p/1822451#M625032 although that has a ring control, not a combobox, with constant contents. However, it would be easy to update the ring elements each time it's moved. Quote Link to comment
Darin Posted February 28, 2013 Report Share Posted February 28, 2013 A similar approach is to intercept the Mouse Down? event and populate the combobox strings based on the clicked element: 1 Quote Link to comment
Dorschty Posted March 7, 2013 Report Share Posted March 7, 2013 Hi,thank you all for your help. I also called National Instruments already and they told me the same, so I changed my program, to display the entries of the combo boxes in a different way! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.