# window plugin: Menu.getItemIndexByText() not working

**URL:** https://forum.servoy.com/t/window-plugin-menu-getitemindexbytext-not-working/11801
**Category:** Classic Servoy
**Created:** [February 19, 2010, 11:42am UTC](https://forum.servoy.com/t/window-plugin-menu-getitemindexbytext-not-working/11801 "2010-02-19T11:42:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Ruben79](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@Ruben79](https://forum.servoy.com/u/Ruben79)
#### Post date: [February 19, 2010, 11:42am UTC](https://forum.servoy.com/t/window-plugin-menu-getitemindexbytext-not-working/11801/1 "2010-02-19T11:42:22Z")

</div>

Our application uses custom menus and we remove some existing MenuItems from for example the Select menu. Since 5.1 changed the menubar plugin to the window plugin, the .getItemIndexByText() function does not work anymore. An empty error dialog appears on that line and this error in console: “Wrapped java.lang.NullPointerException”.

```auto
//get Select Menu
var vSelectIndex = plugins.window.getMenuIndexByText(vSelectMenu);
var vJSelectMenu = plugins.window.getMenu(vSelectIndex);
var vCount = vJSelectMenu.getItemCount();

// Everything works until here

//remove relook menu item
var vRelookUpItemIndex = vJSelectMenu.getItemIndexByText(i18n.getI18NMessage('servoy.menuitem.relookup')); // original code used to work, but now errors

// var vRelookUpItemIndex = vJSelectMenu.getItemIndexByText("Opnieuw opzoeken"); // doesn't work either
// var vRelookUpItem = vJSelectMenu.getItem(20); // does work
// vRelookUpItem contains: com.servoy.extensions.plugins.window.menu.MenuItem@28bed46 {enabled:true,methodArguments:null,name:null,selected:false,text:"Opnieuw opzoeken"}

vJSelectMenu.removeItem(vRelookUpItemIndex);

```

Am I doing someting wrong here? Or is there a possible workaround (until it gets fixed ![:wink:]( "Wink"))?

---

<div class="post-metadata">

### Author: ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)
#### Post date: [February 19, 2010, 1:03pm UTC](https://forum.servoy.com/t/window-plugin-menu-getitemindexbytext-not-working/11801/2 "2010-02-19T13:03:24Z")

</div>

Ruben79,

Please create a case in our support system.

[http://servoy.com/s](http://servoy.com/s)

Rob

---

<div class="post-metadata">

### Author: ![Ruben79](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@Ruben79](https://forum.servoy.com/u/Ruben79)
#### Post date: [February 19, 2010, 1:13pm UTC](https://forum.servoy.com/t/window-plugin-menu-getitemindexbytext-not-working/11801/3 "2010-02-19T13:13:40Z")

</div>

Case 275684 created.

---

<div class="post-metadata">

### Author: ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)
#### Post date: [February 22, 2010, 2:17pm UTC](https://forum.servoy.com/t/window-plugin-menu-getitemindexbytext-not-working/11801/4 "2010-02-22T14:17:13Z")

</div>

This is fixed in next Release.

Rob
