From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

limit array dimension

Solved!
Go to solution
On the front panel is an array of dbl. I want to only allow the user to select four (0-3) using the index display. How can I limit the index display?
0 Kudos
Message 1 of 7
(3,858 Views)
You could expand the array to show the 4 elements, and then hide the index display.
0 Kudos
Message 2 of 7
(3,855 Views)

Yea, I thought of that one. I have several of these, some in a cluster, and I was hoping to do this with a property node, but can't find a way to make it work.

0 Kudos
Message 3 of 7
(3,847 Views)
Solution
Accepted by topic author bassinbc

You can hide the index display, then make a seperate control where you can set entry limits. Use a value change event on it to set the "index values" property to scroll the array. Make the upper limit of the control dependent on the size of the array and the number of elements visible.

 

For example, if the array is size=4 and the display is size=3, only allow 0..1 on the control using data entry limits.

 

You could even wrap the entire thing into an xcontrol. The advantage of an xcontrol is the fact that is also work in edit mode.

Message Edited by altenbach on 02-01-2010 09:35 AM
0 Kudos
Message 4 of 7
(3,832 Views)
I will accept your solution. I haven't used xcontrols and don't understand them, but after trying what you suggested, I seem to have a way to do this now. I have attached the completed example, as it might help someone else. Thanks.
0 Kudos
Message 5 of 7
(3,817 Views)

Here's what I had in mind. 

 

Message 6 of 7
(3,816 Views)

I realize that this post is several years old but, I wanted to share a simpler albeit, different solution while I was looking for an answer to this same problem just today.  I just force the array to wrap back around to the first element (0) when it reaches the size limitation I set (in this case 8 elements).

My particular dilemma was how to match captions to selected elements.  Once my element list was exhausted, continued incrementing would always show the default caption and the selection process falls apart once the range of usable elements has been exceeded anyway.  Setting a fixed cycle around a group of elements solves the problem.  I've attached a .png of the code.

0 Kudos
Message 7 of 7
(2,945 Views)