LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically define the size of an array control (not number of col and rows)

Solved!
Go to solution

Hello Everyone,

 

I am trying to create a small VI in which the user selects the number of columns and rows of an array, and after clicking an "OK" button, the control of the array appears in the control panel (in order to be filled by the user). To this end I use the property nodes of number of columns and number of rows. I don't have any problem with that.

 

However, I would like to "limit" the size of the array control (the control itself, not the dimensions of the array), and make use of vertical and horizontal scrollbars of the array. What I want to avoid is that the user types 100 cols and 100 rows, and appears a enormous array control.

 

I was able to tho this using a table instead of an array, through the property node "size", but I would like to use an array insead a table.

 

Many thanks,

 

Daniel

0 Kudos
Message 1 of 6
(4,175 Views)

I think maybe you confuse the size of the control with the size of the data.

 

If your 2D array SHOWS 5x5 elements, the data within can be anywhere from 0x0 to several thousand x several thousand.

 

Just set the visible size using the "Nr. Columns" and "Nr Rows" as you have already used and fill it with whatever data you have.  By setting a maximum for the rows and columns, the visible size of the array is limited but can contain any size data you can throw at it.  Only showing the scroll bars when neccessary is of course a nice addition.

 

Shane.

0 Kudos
Message 2 of 6
(4,169 Views)

Hi Shane,

 

Thanks for answering, however I am not totally sure this is my case. I think here are 3 "sizes" playing a role: the number of dimensions of the array, the number of elements that contains such array, and the "physical space" that the control occupies in my front panel. (I understand that I have a 2D array).

 

My case is:

Supose that the user selects the number of cols 10 and num of rows 10.

I would like to display in my VI the array control with (for example) 3 centimeters wide and 3 cm height. In this visible small space, the user will find just a few of the cells of the array, but if he wants to fill the full array (10x10 elements), then the user will need to scroll the bars and continue filling the remaining elements.

 

I hope my explanation is not very confusing.

 

Best,

 

Daniel

0 Kudos
Message 3 of 6
(4,161 Views)
Solution
Accepted by topic author Daniel_CB

With an array control you cannot set the display size to be anything else other than a multiple of a full cell.

 

So you are limited to showing a certain number of rows and columns.  If you want to resize with more control than that then you need to also resize the control WITHIN the array, accessible through the "Array element" property.

 

Another option (but seems like huge overkill) is to put your array in a subpanel and set the size of the subpanel to the size you need and activate the scrollbars for it.  It's not an option I would choose but if it helps.....

 

Ont he other hand, your description of your UI does not sound very intuitive.  How does the user know at any given time exactly which cell they are accessing if they have to scroll back and forth?

0 Kudos
Message 4 of 6
(4,148 Views)

I understand your point on that the VI is not quite intuitive. I am still trying to find some alternatives, and also thinking on what I really want to display.

 

I don't understand really well the option of resising the control via "array element" property, but I will take a look at the subpanel alternative.

 

Maybe I can upload a short version of the VI, so you can see my point.

 

In the attached file, there is a decoration box under the table. If you choose number of rows=20, the table will grow and will be overlaped with the decoration box. I want to fix the size of the table, regardless the number of columns the user selects. (I tried to put a property node "size" in the case structure, but it did not work).

 

And if possible, I would like to use an array instead a table.

 

Many thanks for your help,

 

Daniel

0 Kudos
Message 5 of 6
(4,136 Views)

Here's an idea: Why not just set the size of the array on the UI and don't change anything via Property node?  Why won't that work?

 

Or put a "In range and coerce" before the "Set Rows" and limit the size to maximum 7 rows?

 

I don't quite understand why this is a problem to be honest.

0 Kudos
Message 6 of 6
(4,128 Views)