# Disable / grey out context-menu items in vision

**URL:** <https://forum.inductiveautomation.com/t/disable-grey-out-context-menu-items-in-vision/46881>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [May 19, 2021, 11:33am UTC](https://forum.inductiveautomation.com/t/disable-grey-out-context-menu-items-in-vision/46881 "2021-05-19T11:33:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![henning.e.heine](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henning.e.heine/32/70958_2.png) [@henning.e.heine](https://forum.inductiveautomation.com/u/henning.e.heine)\
**Post date:** [May 19, 2021, 11:33am UTC](https://forum.inductiveautomation.com/t/disable-grey-out-context-menu-items-in-vision/46881/1 "2021-05-19T11:33:52Z")

</div>

I am trying to customize the context menue of a component in vision and I would like to grey out one item in the context menu:  
 ![context-menu](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/b/eb15d68aa8a3a9268f7231f016fcbcf79753f8b2.png)

In the context menue that is shown, when i right-click on the root container some items are greyed out. That is what I am trying to do.

 ![context-menu_0](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/f/8f38180f10eab83e674b9fdf6c22063ca55736af.png)

Thanks for any hint on how to achive this.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 19, 2021, 12:49pm UTC](https://forum.inductiveautomation.com/t/disable-grey-out-context-menu-items-in-vision/46881/2 "2021-05-19T12:49:44Z")

</div>

You'll need to create a custom java menu instead of using IA's helper function. This topic will get you started:

> [@Icon beside each item in popup menu](http://forum.inductiveautomation.com/t/icon-beside-each-item-in-popup-menu/11663/2):
>
> You can do it by creating your popup menu with the underlying java classes instead of system.gui.createPopupMenu(). If you look at [JMenuItem](http://docs.oracle.com/javase/8/docs/api/javax/swing/JMenuItem.html), you’ll see it has a constructor that takes an icon and a string. You can use this code to get you started: def showPopup(event): if not event.popupTrigger: return from javax.swing import JPopupMenu, JMenuItem menu = JPopupMenu() x = JMenuItem("Show Tag Tree") def showTagTreeAction(event, comp=event.source.parent.getComponent("TagTree")): comp.v…

The key to your case is that each JMenuItem has a .setEnabled() method. (Follow the link to the javadoc.)

---

<div class="post-metadata">

**Author:** ![henning.e.heine](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henning.e.heine/32/70958_2.png) [@henning.e.heine](https://forum.inductiveautomation.com/u/henning.e.heine)\
**Post date:** [May 21, 2021, 5:29am UTC](https://forum.inductiveautomation.com/t/disable-grey-out-context-menu-items-in-vision/46881/3 "2021-05-21T05:29:04Z")

</div>

Thanks! I will look into that.
