02-07-2014 08:12 AM - edited 02-07-2014 08:15 AM
I'm building a VI that will have hundreds of on/off buttons, 24 on each of 8 tabs. I can deal with them programmatically in an array, like this:
and then find which one was pushed with some XOR'ing:
But what if I want two rows of 12 buttons? Can I make a 2D array of buttons somehow? Or a 1D array of buttons on two rows for cosmetic reasons?
What if I want to put 24 buttons on each of 8 tabs? Can I make a 24x8 array of controls somehow? Or a 12x2x8?
Thanks,
-Jordan
Solved! Go to Solution.
02-07-2014 08:16 AM
Right Click on the Index Display and Add Dimension.
I'd be wary of putting too many buttons though. Makes for a clunky interface.
02-07-2014 08:23 AM
That was easy; here is the two dimensional array:
I can add the third dimesion using this technique, but how do I get access to the third dimension on the front panel, graphically, to make a 12x2x8 array of buttons?
I agree there are a lot of buttons, but it seems like the easiest way to quickly toggle channels on and off, much quicker than a drop down menu or some other interface. What would you recommend?
Thanks,
-Jordan
02-07-2014 08:24 AM
Anything's possible. Right click on your control and add a dimension if you wish to make it a 2x12 array. You can add a third dimension to an array (page), but it's not particularly useful for front panel controls.
You could consider having a 2nx12 array with labels next to each block of 2n arrays. Or, and I think this is the most expandable myself, an array of clusters of 2x12 arrays:
You can tidy up the appearance as you wish, and of course you'll have to deal with the logic of what's been updated (a quick search through here will show you how to check which element of a cluster has changed, for instance).
02-07-2014 08:55 AM
@jordanglassman wrote:
I agree there are a lot of buttons, but it seems like the easiest way to quickly toggle channels on and off, much quicker than a drop down menu or some other interface. What would you recommend?
Thanks,
-Jordan
Depends on what the actual purpose of the interface is.
Will you actually need access to all channels all at once?
Normally, I'd start with some sort of a ListBox or Tree to narrow down the information to only what's relevant.
With so many buttons, I think the risk of a misclick is pretty high.
02-10-2014 08:50 AM
Let's consider a tab control scenario with an array of 24 buttons on each tab, with 8 tabs.
If I understand you correctly, I will need to use a separate 2D array of buttons for each tab. It's not possible to have a 12x2x8 array of buttons? I will need to monitor all 8 arrays separately for events?
Thanks!
02-10-2014 08:56 AM - edited 02-10-2014 08:57 AM
02-10-2014 08:59 AM
Aha! I didn't know you could assign multiple events to one case. This allows me to emulate a "3D" array of controls. Thanks!
02-10-2014 09:55 AM - edited 02-10-2014 09:55 AM
jordanglassman wrote:I can add the third dimesion using this technique, but how do I get access to the third dimension on the front panel, graphically, to make a 12x2x8 array of buttons?
I would probably use a 3D array directly. You can easily hide the index terminal (and scrollbars) and add a custom numeric control to select the visible plane via an event structure.
Make sure to make the full sized 3D array the default or initialize it at program start.
02-10-2014 10:06 AM
@jordanglassman wrote:
and then find which one was pushed with some XOR'ing:
I would strongly recommend to replace the XOR with a not equal. Same outcome, but less nerdy. 😄 It is also much more universal! For example if you ever need to do this on an array of numerics to see which element got changed (I often do!), the XOR will no longer work as well (with integers, you'll end up with bitwise comparisons and numeric results, and with DBLs you'll end up with coercions and unpredictable results because bits are lost).