From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Shortcut Menu Plug-Ins

cancel
Showing results for 
Search instead for 
Did you mean: 

Change to Array feature request

This plugin, which comes pre-installed with LabVIEW, is very useful.

However, currently:

- it creates an empty array

- the element within this array are resized to some default (small) size:

Screen Shot 2015-12-04 at 12.31.10.png  Screen Shot 2015-12-04 at 12.36.05.png    Screen Shot 2015-12-04 at 12.36.27.png

gives this:

Screen Shot 2015-12-04 at 12.31.24.png   Screen Shot 2015-12-04 at 12.36.15.png    Screen Shot 2015-12-04 at 12.36.48.png

In general, I presume that the user would want an array with the first element equal to the object initially selected (at least that's what I want in general).

Secondly, assuming the previous preference, for many objects, resizing to the original size is desirable.

My suggestions would be to implement those two improvements to the plugin.

Comments
X.
Trusted Enthusiast
Trusted Enthusiast
on

Actually, there appears to be a bug with these scripts.

Take the attached constant:

Change to Array Bug.png

Try the Change to Array shortcut: in my hands, it transiently creates an array and then reverts to a single element. You may have to Change to Array and Change to Element a few times before this happens.

Now disconnect the DBL constant from its typedef: now the Change to Array or Change to Element work as advertised.

I had this happen to me with any typedef containing cluster.

X.
Trusted Enthusiast
Trusted Enthusiast
on

This also works on FP. Take an object, drop it into a Tab Control which you have made a Typedef before and try to use Change to Array on the object: The array will appear briefly and then disappear.

AristosQueue (NI)
NI Employee (retired)
on

Sorry ... I just saw this thread.

The conversion to an empty array is deliberate. The most common use cases we had for this request is a) to create an array initializer for a shift register from the type that will be used inside the loop and b) to use an existing type and morph it into the start of an array algorithm. Both of these call for  an empty array.

The size issue is one I wish I could fix, but I couldn't find a stable way to script the new arrays retaining the original sizes. The definition of size among LV elements is just too heterogenous -- one of those artifacts that has built up over years and will take a significant refactoring to address (a refactoring that is underway but slow in coming).

Re: The cluster containing a typedef. It works just fine if the typedef is found. It fails if the typedef is missing. You note that Change To Control and Change To Indicator are both grayed out in that case ... I need to gray out Change To Array as well. Thanks for catching that.

Re: Your post from yesterday -- the Change To Array is attempting to change the tab control into an array because the tab is a typedef, and the outermost typedef is presumed to be the owning control by the scripting algorithm. I didn't know you could make a tab control a typedef until you posted this -- Tab Controls can't go in so many places... putting one in a typedef honestly surprised me. I'll have to code in an explicit ignore of tab controls. That's going to be annoying -- I think it means I can't use the common subVI for finding nearest modifable control, or I need to modify the common subVI and then retest a lot of things. Bleh. But thanks for finding it.

I'm not sure if I have time to get either of these fixed in 2016 but I'll try.

X.
Trusted Enthusiast
Trusted Enthusiast
on

Regarding my latest post, I need to clarify: The typedef tab is just here as a UI element, it is not part of the object.

But if an object IN THE TAB is processed with this shortcut, the action fails.

As for why I use typedef tabs: my UI switches tab programmatically, and it is convenient to have a typedef tab which I can pass a typedef enum to to switch from tab to tab, keeping both in sync (I guess this explanation is a bit too concise to make much sense, but the bottom line is that I have a good reason to use typedef tabs).

AristosQueue (NI)
NI Employee (retired)
on

I wasn't questioning the reasoning... I just didn't know it could be done. 🙂

AristosQueue (NI)
NI Employee (retired)
on

I'm fixing the first issue to correctly gray out the menu item when it won't work. But I'm not going to fix the tab control issue. Making the tab control case work will take a substantial amount of code, by my judgement at the moment, and the return on investment isn't there. It's going to stand as a known issue.

X.
Trusted Enthusiast
Trusted Enthusiast
on

Another undesirable feature is the following:

if you start with a cluster constant shown as an icon, and use Change to Array, the cluster in the resulting array is expanded (not an icon anymore).

Contributors