LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
PhillipBrooks

Multicolumn List Box - Expose the ItemNames Array Size as a property

Status: New

A multicolumn list box is often decorated by a sub-vi via a control reference.

 

A common example would be coloring the background of alternate rows or columns.

 

In order to all columns or rows, a sub-VI must retrieve the ItemNames array via the reference to determine the number of iterations.

 

Add a property node for the MCL that returns the size of the ItemNames array directly so the ItemNames array does not need to be retrieved.

 

 

 

MCL - ItemNames Array Sizes.PNG

3 Comments
X.
Trusted Enthusiast
Trusted Enthusiast

I don't get it... Are you saying that you'd rather connect an integer to the loop count than doing what you are showing above? That looks elegant enough to me...

In this vein, you could ask for a size of the cursor or annotation arrays for graphs, for instance, but I suspect that in all cases, if you actually don't do anything with the autoindexed array (as in your illustration), there will be no cost in terms of performance (at least I would hope the compiler to understand that).

 

As a side note, why are the error cluster icons red on the right handside fo your property nodes?

PhillipBrooks
Active Participant

By retrieving the ItemNames array, the vi shown has to unecessarily allocate RAM to contain the array.

 

In this case, I only want to know the number of rows and columns so that I can set the colors via the same reference. 

 

The red error cluster connector is because the node is set to ignore errors: from the help:

 

The node executes each property in order from top to bottom. If an error occurs on a property, the node stops at that property, returns an error, and does not execute any further properties. You can right-click the node and select Ignore Errors Inside Node from the shortcut menu to ignore any errors and continue executing further properties. If an error occurs when Ignore Errors Inside Node is set, the property node still returns that error. The error out cluster reports which property caused the error.

X.
Trusted Enthusiast
Trusted Enthusiast

I was just questioning the assumption that LV will indeed allocate memory for the array (which in any case will not be much unless your table is very large). I was under the impression that the compiler was doing some optimization and I would think that auto-indexing an array without using any of the elements would hopefully not result in a copy. That's a question for an insider to answer (unless you benchmarked that and convinced yourself that it does indeed allocate memory for a copy of the array?).

Thanks for the pointer on "ignore error". I am rather sloppy in handling errors, but I don't disable them! Now that begs the question: why do you connect the error cluster input in this specific example, if you are planning on ignoring them :-?