I had this:
plugins.window.getMenuBar().removeMenu(6,5,4,2,1,0);
I get the warning:
The method removeMenu(Array) in the type plugins.window.MenuBar is not applicable for the arguments (Number,Number,Number,Number,Number,Number)
The I tried as described in the help/documentation built in Servoy, which is:
Remove the menu(s) at the selected index/indices.
// Note: method removeMenu only works in the smart client.
var menubar = plugins.window.getMenuBar();
// To remove the last menu in the menubar we count the number of menu's in the menubar
// because the index starts at 0 we have to substract 1 from the counted menu's
// to actually remove the last menu from the menubar
var index = menubar.getMenuCount() - 1;
menubar.removeMenu(index);
// To remove the last 3 (three) menu's from the menubar we
// can do that by adding additional indexes to the method
// and delimit them with a comma.
index = menubar.getMenuCount() - 1;
menubar.removeMenu(index, index-1, index-2);
// For 'security' reasons it is best to ALWAYS remove the menu with the last index
// first to avoid index out of range issues and other issues
// EXAMPLE: when you first remove the menu at index 2 and then the menu at index 4
// you actually remove the menu at index 2 and index 5
// after removing the menu at index 2 all other menu's moved one index to the left
// so the menu at index 4 moved to index 3 and the menu at index 5 moved to index 4 etc.
@param {Object[]} index array of one or more indexes corresponding to menus to remove
And so, I tried this:
var menubar = plugins.window.getMenuBar();
var index = menubar.getMenuCount() - 1;
menubar.removeMenu(index, index-1, index-2, index-4, index-5, index-6);
I still keep getting the warning. For now, I’ll just suppress the warning for now with:
- @SuppressWarnings(wrongparameters)
If anyone have any other idea on how to wipe out this warning, please let me know.
Best, Carlos.