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: 

Fix Array Front Panel Dimension but Allow User to Change Array Size

Solved!
Go to solution

Hi

 

I know there's a few other posts on array and scroll bars but mine is a bit different. I want to have the physical dimension of the array control fixed and allow the user to vary the size of the array as needed and a scroll bar if the number of elements exceeds the physical dimension specified. I would not mind if at the end of the scroll bar the user sees an un-initialized element.

 

Thanks very much

0 Kudos
Message 1 of 9
(3,217 Views)

Try something like this

 

Example_VI_BD.png

=====================
LabVIEW 2012


0 Kudos
Message 2 of 9
(3,208 Views)

Hi

 

I implemented the code but it seems that whenever Number of Rows is used, the array automatically resizes to show that many rows layed out in a flat sequence and over-rides the scroll bar and I'm looking for a way such that the array dimension stays constant (or grows to a constant value and then scroll bar is added) since I'm not sure how many elements the user will add.

 

Thanks very much

0 Kudos
Message 3 of 9
(3,200 Views)

I'm not too sure I understand exactly what you want. This code sets a maximum number of rows which, if exceeded, will show the scrollbar. That's why I said "something like this" Smiley Happy

 

You now know how to programatically change the number of elements shown and how to programatically turn on or off the scrollbar. I think that knowing these two things will allow you to get the behavior you want. But let me know if I am missing something.

=====================
LabVIEW 2012


0 Kudos
Message 4 of 9
(3,187 Views)
Solution
Accepted by topic author Red_CCF

Hi

 

The problem I'm having with the Num Row property node is that it seems to override the scroll bar. Whenever I try to change Num Row, the array automatically re-sizes its physical dimension on the front panel and the scroll bar has no effect.

 

However I fixed the problem by taking out Num Row completely. I just said if Array size is > than some constant value (i.e. 3), add a scroll bar, and sized my front panel array to be one size bigger than what that constant value is. Once I begin adding values in a sequential order and I reach the fourth value, the scroll bar is added and the scroll bar has a feature where it adds a null element for you, so if I fill that null element I just increased the size of the array and another null element appears below it. 

 

Thanks for the help

0 Kudos
Message 5 of 9
(3,175 Views)

@Steve Chandler wrote:

Try something like this

 



I liked your answer...btw, give yourself a "checked marked solution" or I will.Smiley Wink

0 Kudos
Message 6 of 9
(3,169 Views)

I don't understand why you think there is a problem with the properties.  There is no "overriding" of the scrollbar.

 

Of course the array will resize.  The property node num rows sets the number of visible rows on the front panel.

 

As to whether there is a scrollbar or not, it all depends on whether you need it as to whether it shows it.  If the scrollbar is visible, then it shows it.  But if the number of elements in the array is less than the number of rows visible, you don't get an active scroll bar.  If the number of elements is equal to or greater than the number of visible rows, you do get an active scroll bar when it is visible.  You need that so you can get to the elements that are off the ends, or get to an inactive array element so that you can type in more array elements at the end.

 

What you did in your snippet isn't needed, (unless you want to hide the scrollbar when it isn't needed).  In which case your comparison should be >= going into the scrollbar.visible property node.

0 Kudos
Message 7 of 9
(3,166 Views)

Hi

 

Sorry but I didn't mean that there was a problem with the property node, just that it wasn't doing what I wanted. I think by changing the Number of Rows property node, the number of visible rows changes such that the scroll bar is never needed. Based on what I did it seems that when the Number of Rows changed, the scroll bar never appears and the array just gets bigger on the front panel even though I enabled the scroll bar both in the control and block diagrams but I could have likely made an error if this wasn't suppose to happen. The way I did it works for what I need so I didn't look into this further.

 

But I am interested in learning what I did wrong if you could point it out for future references.

 

Thanks very much

0 Kudos
Message 8 of 9
(3,161 Views)

As I said, try greater than equal to in your comparison for the earlier posting, rather than just greater than.

 

I just think you are confused as to what you want, versus the way you coded it.

0 Kudos
Message 9 of 9
(3,155 Views)