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: 

Bug or Feature? Array Custom Contextual Menu Destroys "Delete" and "Insert" Element!

Step to Reproduce:

 

- Create an Array (doesn't matter of what type).

- Ctrl-M (to switch to Run Mode)

- Notice that:

       - when you Right-Click on the Array borders, you have access to an "Empty Array" menu item among other things

       - when you Right-Click in an Array element, you have access to an "Insert Element Before" and a "Delete Element" menu item among other things

 

- Now switch back to Edit Mode and modify the contextual menu in the following way:

        - Advanced>>Run-Time Shortcut Menu>>Edit...

        - Edit>>Copy Entire Menu

        - Switch to "Custom" menu (instead of "Default"): the menu disappears and is replaced by a single ??? item

        - Edit>>Paste: The default menu reappears with the ??? on top

        - Create you favorite custom menu item by editing the ??? item (say: Do Nothing)

 

- Save the menu with the control and switch to Run Mode (Ctrl-M).

- Now try the first 3 steps above: wherever you right-click, you have access to the Custom Menu, but the Array Element contextual menu is GONE.

 

In other words, you cannot (it seems) define a custom contextual menu for an array without destroying the default contextual menu for its elements.

Therefore, if you want to preserve the ability to Insert and Delete Elements in an array, you have to add these two items to the Array contextual menu and juggle with the position of the right-click to figure out whether or not to display them...

 

 

Message 1 of 14
(7,640 Views)

Oops, I did it many times, but never realized this. Thank you for sharing this. Its definitely a bug for me, probably there has to be a CAR or someone will create one now.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 2 of 14
(7,619 Views)

Bump for the LabVIEW 2014 Beta Testers (I am not signing up).

0 Kudos
Message 3 of 14
(7,549 Views)

Is anyone at NI concerned about fixing bugs defeating the purpose of providing programmer with the ability to try and improve the look and feel of their UI?

0 Kudos
Message 4 of 14
(7,444 Views)

Well, I created in LabVIEW 2012 such a control and added part of the default menu in the way you described with copy-paste as a submenu to an Edit entry in my custom menu and it did not disappear:

 

editmenu.png

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 14
(7,422 Views)

Hi X.,

 

This has been reported to our R&D department as Corrective Action Request (CAR) #52603. You can reference this CAR number in the LabVIEW release notes to determine if it has been fixed for a particular version of LabVIEW.

 

In the meantime, you could potentially add the application item tags for adding and deleting an element (APP_SC_INSERT_ELEMENT_BEFORE and APP_SC_DELETE_ELEMENT) to the run-time menu. Once I did that, the context menu for the elements in the array included the ability to add and delete elements from the array.

 

Best Regards,

Matthew B.
Offering Manager
NI
Message 6 of 14
(7,384 Views)

I am not sure what you have in mind.

If I add such items, I have to do this in the Array contextual menu.

The whole menu then appears wherever I click into the array.

In particular, I can supposedly insert or delete an element when I click on the array border or index, which does not make any sense (it also doesn't do anything, which will confusing for the user).

Worse, when I click on an element of the array, I have the whole menu available too. Of course only the two added items are functional there, so "Empty Array" or whatever else doesn't have any effect. More confusion.

Is this what you are suggesting? A kind of blanket a-contextual menu?

0 Kudos
Message 7 of 14
(7,352 Views)

Just ran into this bug today. Has this been resolved? Tried finding that CAR reference but not sure where to look. Thanks.

0 Kudos
Message 8 of 14
(7,245 Views)

Hello mattvx,

 

There is a workaround..Don't customize the shortcut menu at all. Then add a "Shortcut Menu Activation?" event on the array. In the body of that event case, see if SubObj is NotAReference. If it is, then the array itself was clicked on, so nothing to do. But if it's NOT NotAReference (i.e. it IS a valid reference), then you know that an element was clicked on, and you can then call the "Delete Menu Items" function to remove the following menu items:


APP_SC_INSERT_ROW_BEFORE
APP_SC_INSERT_COLUMN_BEFORE
APP_SC_DELETE_ROW
APP_SC_DELETE_COLUMN


The desired menu should then show.

0 Kudos
Message 9 of 14
(7,214 Views)

What do you mean by "don't customize the shortcut menu at all"?

That's precisely the intent!

I want to customize the shortcut menu while keeping some of the native functionalities.

0 Kudos
Message 10 of 14
(7,200 Views)