JSMenuItem methodArguments

Hi!

Now the methodArguments are passed as arguments 5 and so on to the callback method.
I noticed that the argument 4 is the text of the menu item… but what are the previous arguments passed to the callback method?

Thanks!

Victor,

About what plugin and what Servoy version is your question?
Can you give a little sample code?

Does the sample code provided not help?

Rob

Hi Rob.
Sorry, I should be more specific…

Servoy version 5.1.0 - build 956

I’m talking about the popup menu plugin that now (from 5.0 I think) is inside the window plugin.
Before this change to create a popup menu was:

var menu = new Array();

menu[1] = plugins.popupmenu.createMenuItem('Menu Item 1',<callback_method>);
menu[1].setMethodArguments(<array_arguments_for_callback_method>)

plugins.popupmenu.showPopupMenu(<triggered_element>, menu);

<array_arguments_for_callback_method> was passed as arguments 0 and so on.

Now to create a popup menu:

var menu = plugins.window.createPopupMenu();
var menuItem1 = menu.addMenuItem('Menu Item 1',<callback_method>);

menuItem1.methodArguments = <array_arguments_for_callback_method>;

menu.show(<triggered_element>);

The sample code provided:

   var menu = plugins.window.getMenu(2).getItem(0);
// Set the text of the item.
menu.setText("Servoy");
// Set the method for the item.
menu.setMethod(callback);
// Set the arguments that can be read by the defined method. - array elements will be passed as arguments 5, 6 and so on to the callback method
menu.methodArguments = ["a","b"];
// Set the icon of the item.
menu.setIcon("media:///TipOfTheDay16.gif");
// Set the accelerator key of the item.
menu.setAccelerator("meta 4");
// Set the mnemonic key of the item.
menu.setMnemonic("e");
// Enable/disable the item.
menu.setEnabled(false);
// Set the item visible.
menu.setVisible(true);

I want to know what are the arguments 0 to 4 passed to the callback method.
Maybe this info could be added to the wiki.

Thanks for the feedback!

Victor.

The window plugin in Servoy 5.1 contains a merge if the menubar plugin (originally from ITBE) and the popupmenu plugin.
These arguments are a legacy from the menubar plugin and are kept for backward compatibility.

They are:
[0] item index
[1] parent item index
[2] isSelected boolean
[3] parent menu text
[4] menu text

Rob

Thank you very much Rob!