window plugin: Menu.getItemIndexByText() not working

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”.

//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:)?

Ruben79,

Please create a case in our support system.

http://servoy.com/s

Rob

Case 275684 created.

This is fixed in next Release.

Rob