MartinMcD Posted May 13, 2011 Report Share Posted May 13, 2011 Hello everyone, I was wondering if there is a way of having an emum or ring control in an array which has different strings for each row? The array element would be a cluster with two enum controls - the selection of the first would determine the strings available in the second. Unfortunately I do need to use an array. If I figure it out I'll post back. Thank you, Martin Quote Link to comment
MartinMcD Posted May 13, 2011 Author Report Share Posted May 13, 2011 I realise what I asked is impossible, Friday afternoon wishful thinking. The number of rows the user will need is not known at build time hence the array. Perhaps there is another way of getting what I want. Quote Link to comment
Jarrod S Posted May 13, 2011 Report Share Posted May 13, 2011 I realise what I asked is impossible, Friday afternoon wishful thinking. The number of rows the user will need is not known at build time hence the array. Perhaps there is another way of getting what I want. The standard way to fake this is to have a cluster hard-coded to contain a few entries with a custom scrollbar running down the side. The data you store is an array, but the front panel control is a cluster. Depending on the position of the custom scrollbar, you copy in the selected array subset into the cluster. Quote Link to comment
ned Posted May 13, 2011 Report Share Posted May 13, 2011 I've done something like this with a table control and a ring. When the user clicks on a cell in the table (or tabs to it), I populate the ring with the appropriate set of values, then move it on top of that cell. When that cell loses focus, copy the text from the ring into the cell in the table and hide the ring control (or move it to the next cell). It takes a bit of work, and the interface isn't perfect (you have to click twice in the table cell to select a value: once to get the ring there, the second time to pop it down) but it looks pretty good and works well. I like to fill the entire table with something like "Select..." and also have that as the first value in the ring so it's clear that the user can select a value, and when moving back to a cell that has previously been set I make sure to set the ring control to the matching value before moving it into place. Quote Link to comment
MartinMcD Posted May 14, 2011 Author Report Share Posted May 14, 2011 Thank you for the good ideas, I will give it a go. Quote Link to comment
jgcode Posted May 15, 2011 Report Share Posted May 15, 2011 I was wondering if there is a way of having an emum or ring control in an array which has different strings for each row? The array element would be a cluster with two enum controls - the selection of the first would determine the strings available in the second. Unfortunately I do need to use an array. If I figure it out I'll post back. I realise what I asked is impossible, Friday afternoon wishful thinking. The number of rows the user will need is not known at build time hence the array. Perhaps there is another way of getting what I want. Hi Martin You can do this and I have done it before. Here is a screenshot of an example: You just have to use Rings (not Enums - FWIW I don't use Enums as display elements anyways, only as application data) and don't use Strict Type Defs for the Rings, Cluster or Array as then you cannot change the Ring's Strings[ ] property (it throws a Run Time error if I remember correctly). In the example the UI element is an Array of Clusters where one element is a Ring. I just use VI Server Refnums to populate the Rings at Run Time (e.g. on changes in the Applications etc...) and they can be different even though they are in an Array. Cheers -JG Quote Link to comment
blawson Posted June 3, 2011 Report Share Posted June 3, 2011 Hi Martin You can do this and I have done it before. Here is a screenshot of an example: You just have to use Rings (not Enums - FWIW I don't use Enums as display elements anyways, only as application data) and don't use Strict Type Defs for the Rings, Cluster or Array as then you cannot change the Ring's Strings[ ] property (it throws a Run Time error if I remember correctly). In the example the UI element is an Array of Clusters where one element is a Ring. I just use VI Server Refnums to populate the Rings at Run Time (e.g. on changes in the Applications etc...) and they can be different even though they are in an Array. Cheers -JG What properties of the ring are you changing? In my experience, if you change the ring's strings[] property, it changes existing values to the new values or to <#> if there is no longer a match. I've done this with a combobox (and undefined items disabled). -B Quote Link to comment
dim_V Posted June 14, 2011 Report Share Posted June 14, 2011 You could use custom .NET control (table or listbox with embedded comboboxes, checkboxes,etc), but it's a bit tricky. Quote Link to comment
drjdpowell Posted June 15, 2011 Report Share Posted June 15, 2011 You could also consider using a multi-column listbox and right-click menu, customizing the menu to the set of options available for the specific box right-clicked on, then write the selected option into the box. Quote Link to comment
mzu Posted June 15, 2011 Report Share Posted June 15, 2011 Have you tried Type Sensitive Popup Quote Link to comment
jgcode Posted April 7, 2012 Report Share Posted April 7, 2012 ...and they can be different even though they are in an Array. I revisited this post as someone PM'd me for code. When I looked at the code the UI structure I posted is actually a Cluster of Clusters (not an Array of Clusters as I thought when I just posted a screenshot). So what I wrote was wrong regarding Arrays, apologies - it looks like you cannot have different Ring Strings[] in an Array. The Channels did not need to be dynamic so this was fine as a workaround for this use case. Here is how I updated the ring (there was only one ring, so searching by ClassName was fine in this case, but you could do it another way) in each Cluster to display different Strings[]. Cheers! -JG Quote Link to comment
Ravi Beniwal Posted April 21, 2012 Report Share Posted April 21, 2012 I've done something like this with a table control and a ring. When the user clicks on a cell in the table (or tabs to it), I populate the ring with the appropriate set of values, then move it on top of that cell. When that cell loses focus, copy the text from the ring into the cell in the table and hide the ring control (or move it to the next cell). It takes a bit of work, and the interface isn't perfect (you have to click twice in the table cell to select a value: once to get the ring there, the second time to pop it down) but it looks pretty good and works well. I like to fill the entire table with something like "Select..." and also have that as the first value in the ring so it's clear that the user can select a value, and when moving back to a cell that has previously been set I make sure to set the ring control to the matching value before moving it into place. You won't need to click twice to change the value if you position the ring on mouse move rather than mouse click. You can track the mouse and re-position the ring only when the cell changes. If the ring appears on a cell on "mouse over", it will give the user a hint that he can click on it to select a value from a list. Quote Link to comment
ned Posted April 23, 2012 Report Share Posted April 23, 2012 You won't need to click twice to change the value if you position the ring on mouse move rather than mouse click. You can track the mouse and re-position the ring only when the cell changes. If the ring appears on a cell on "mouse over", it will give the user a hint that he can click on it to select a value from a list. Thanks for the idea. I posted my approach to this several months back at http://forums.ni.com/t5/LabVIEW/array-of-cluster/m-p/1822451#M625032. With that code I can simply change the "Mouse Down" event to "Mouse Move" and get the behavior you suggest. I'm not sure I like the visual results of doing that, and I'm no longer working on the project for which I first wrote that code so no need to improve it now, but perhaps I'll take another look at it the next time I need a similar interface. 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.