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: 

Strictly Define Array Control Limits - Is it possible?

I would like to strictly define the size of an array of clusters for a control. Basically I don't want the user to be able to initialize more than 12 elements in an array of clusters. Of course, the best way is always to not let the user operate directly on the data clusters and instead have some kind of table or something and detect inputs and only let my function edit the data itself to manage user error and insure input validity... but I dont want to spend that much time on it. I just want to set the size of the array as a constant and not let the user create more elements in the array control. This has come up a few times and I was hoping there was a setting I am missing somewhere.

 

Is it possible?

 

Array of clusters UI.png

---------------------------------
[will work for kudos]
0 Kudos
Message 1 of 12
(5,045 Views)

I do not think you can limit the size of an array.

 

You can hide the index control and only show the specified number of elements.  Your image seems to imply that you do not want to display all the elements at one time.  You could use a slider (I32 datatype) and use that value as the input to a property node (Index Values) to control which elements are displayed.  By limiting the range of the slider you can limit what is displayed.

 

I am not sure this is any easier than the table approach.

 

Lynn

0 Kudos
Message 2 of 12
(5,036 Views)

For a more detailed discussion see my reply to this idea suggestion.

 

Frankly, I am surprised that this idea is not very popular (only 6 votes so far!!! :() The ability to disallow the resizing of array controls is severly needed and I urge anyone to support the idea quoted above! We need this!!!!


Let me quote from my post:

 


All we need is a new property e.g. named "allow resize" for the array, default is true to duplicate the current behavior. It should work for arrays of any dimension. If set to false, the following changes are applied at run time (they are ignored in edit mode):

 

  • Clicking on an element outside the current range at runtime (greyed element!) has no effect.
  • Scrolling to the bottom of the array stops at the last element and not "last element +1

Thanks!
Message 3 of 12
(5,022 Views)

Idea Kudoed. What a pain in the bum.

---------------------------------
[will work for kudos]
0 Kudos
Message 4 of 12
(4,970 Views)

 


@johnsold wrote:

I do not think you can limit the size of an array.

 

You can hide the index control and only show the specified number of elements.  Your image seems to imply that you do not want to display all the elements at one time.  You could use a slider (I32 datatype) and use that value as the input to a property node (Index Values) to control which elements are displayed.  By limiting the range of the slider you can limit what is displayed.

 

I am not sure this is any easier than the table approach.

 

Lynn


You could hide the array's controls and implement a set of your own. You would then have control over how many elements are allowed. It is not the most straight forward to implement but I have done this with a set of buttons that allow control over viewing, adding and deleting elements in an array. It would be trival to include a maximum size for the array. Here is an example of what I am talking about.

NOTE: All of the clusters were typedefed. I disconnected them to reduce the number of attachments. For some reason there was still one reference to the typedef included but I can't seem to find it in the code. Showing it from the VI hierarchy flashes a spot on the BD and that is all.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 5 of 12
(4,950 Views)

Thanks Mark. Actually it was just the room I had in that tab on my UI at the time. Since I ended up hiding all the arrays' controls and creading my own event for the slider anyways I reduced the array to one element and I show the actual channel name rather than just the index number to help avoid user confusion.

 

Thanks for all your help guys. It looks like the only way to really insure data validity and keep the user from initializing new elements in the array that would mess up all my operations is to hide the arrays controls and complete re-create them on my own, slider and index control. Altenbach's links were what I needed to get it done yesterday. The discussion he linked had a few different workarounds for the problem.

 

I dont think the problem will be "solved" until NI implements some form of the ideas presented in the idea exchange discussion. Until then we will be stuck implementing more UI workarounds, lol.

---------------------------------
[will work for kudos]
0 Kudos
Message 6 of 12
(4,925 Views)

You probably saw this too.

Message 7 of 12
(4,913 Views)

Yes it was very helpful thanks altenbach. Smiley Very Happy

---------------------------------
[will work for kudos]
0 Kudos
Message 8 of 12
(4,877 Views)

I have handleled this with a user event, just preventing on value change if the new array is too large.

See attached, it takes about 30 seconds to implement.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 9 of 12
(4,864 Views)

Just enforcing an upper size limit is easy. We want:

 

 

  • disallow any resizing (larger, smaller)
  • suppress the right-click menu for "add element before" and "delete element"
  • with the scrollbar scrolled to the bottom, don't show the first out of range element.
  • ...
Yes, it could all be done in code, but I think LabVIEW needs native support for this. 🙂

 

 

0 Kudos
Message 10 of 12
(4,858 Views)