I’m trying to use the new window plugin for a popup menu with servoy 6 (Version: 6.0.3 - build 1223).
Please find the attached example code.
function clickBtn()
{
var popupmenu = plugins.window.createPopupMenu();
var menuitem1 = popupmenu.addMenuItem('H', globals.testPrint);
//add arguments to the method call
menuitem1.methodArguments = ['Hello'];
var source = event.getSource();
if (source != null)
{
popupmenu.show(source);
}
}
Global Method
-----------------
/**
* @param {String} _print
*/
function testPrint(_print) {
application.output(_print);
}
Popup menu works fine with the above code. But passing arguments is not working properly.
When I select the “H” menu item of the popup menu, console always prints the output “-1.0” instead of “Hello”.
Is there any mistake in my code or better way to handle this scenario?
you see the old behavior of that popup menu as far as i see,
you get way more arguments then just 1, add 6 more arguments and print those out… i think the 6th is “hello”
hmm the boolean is called legacyMenubarArguments that generates that
But that is true for all the current createMenuItem methods
And it is false for the old deprecated once… So it seems to be a bit in reverse of what the boolean name tells me