{column:width=80px}{column}{column}{column}
Property Summary
{column:width=80px}{column}{column}{column}
Method Summary
void
doClick()
Script the selection (emulate a mouse click) of the item.
void
set(text, method, arguments, icon, key, mnemonic, enabled, visible)
Define the item with a text and a global method.
void
setAccelerator(key)
Set the accelerator key of the item.
void
setArguments(arguments)
Set the arguments that can be read by the defined method.
void
setEnabled(enabled)
Enable/disable the item.
void
setIcon(icon)
Set the icon of the item.
void
setMnemonic(key)
Set the mnemonic key of the item.
void
setVisible(visible)
Set the item visible.
{column:width=100%}{column}
Property Details
Replace with description
Parameters
Also see
External links
Sample
{column:width=100%}{column}
Method Details
void
doClick
()
Script the selection (emulate a mouse click) of the item...
Parameters
Returns
void
Also see
External links
Sample
// Script the selection (emulate a mouse click) of the item... // Clicking a separator will throw an error! plugins.menubar.getMenu(2).getItem(0).doClick();
void
set
(text, method, arguments, icon, key, mnemonic, enabled, visible)
Define the item with a text and a global method. Arguments, icon, accelerator, mnemonic key, visibility and enabling are optional...
Parameters
text
method
[arguments]
[icon]
[key]
[mnemonic]
[enabled]
[visible]
Returns
void
Also see
External links
Sample
// Define the item with a text and a global method. Arguments, icon, accelerator, mnemonic key, visibility and enabling are optional... // get the menu at the last index // indexes start at 0 (zero) so index 2 is in fact position 3 var menu = plugins.menubar.getMenu(plugins.menubar.getMenuCount() - 1); // when you don't define an index the item will be added at the last position // this is what you usually do to build a new menu var item = menu.addItem(); // create the settings for the specified menu item // minimum settings are the text and method properties // the method can be a global or form method // be sure to enter the method WITHOUT '()' at the end item.set("item with feedback",globals.feedback_item); var item = menu.addItem(); // add an 'input' array. the array will be concatenated to the end of the arguments // array which can be read out in the selected method var input = [1,"is","the","added","input",false]; item.set("item with input",globals.feedback_item,input); var item = menu.addItem(); // add an icon to the item item.set("item with icon",globals.feedback_item,input,"media:///yourimage.gif"); var item = menu.addItem(); // add an accelerator key ('alt shift 2' in the below example) // REMARK: always test the accelerator key. sometimes they will not work because // these keys already have an 'action' assigned to them via the operating system. item.set("item with accelerator",globals.feedback_item,input,"media:///yourimage.gif","alt shift 2"); var item = menu.addItem(); // add a mnemonic key ('i' in our example) which is the underlined shortkey on windows // REMARK: setting the mnemonic key is platform dependent // the accelerator key will not work in this and the next example item.set("item with mnemonic",globals.feedback_item,input,"media:///yourimage.gif","pressed COMMA","i"); var item = menu.addItem(); // disable the menu item item.set("item disabled",globals.feedback_item,input,"media:///yourimage.gif","meta HOME","t",false); var item = menu.addItem(); // set the menu item to be visible // this accelerator key will work item.set("item visible",globals.feedback_item,input,"media:///yourimage.gif","shift meta PAGE_DOWN","e",true,true); var item = menu.addItem(); // now the item is enabled and NOT visible item.set("item invisible",globals.feedback_item,input,"media:///yourimage.gif","A","m",true,false); // add a separator at the last position or at a given index menu.addSeparator(); return; // when you don't define an index the checkbox will be added at the last position // this is what you usually do to build a new menu var checkbox = menu.addCheckBox(); // create the settings for the specified menu item // minimum settings are the text and method properties // the method can be a global or form method // be sure to enter the method WITHOUT '()' at the end checkbox.set("item 09",feedback_checkbox); // ,false,input,"media:///yourimage.gif"); var checkbox = menu.addCheckBox(); checkbox.set("item 10",feedback_checkbox,true,null,"media:///yourimage.gif"); // add a separator at the last position or at a given index menu.addSeparator(); // add a new Radiobutton Group // the Radiobutton Group 'binds' the added radiobuttons to each other menu.addRadioGroup(); var radiobutton = menu.addRadioButton(); radiobutton.set("item 12",feedback_radiobutton,false,input,"media:///yourimage.gif"); var radiobutton = menu.addRadioButton(); radiobutton.set("item 13",feedback_radiobutton,true,null,"media:///yourimage.gif"); // add a new Radiobutton Group menu.addRadioGroup(); var radiobutton = menu.addRadioButton(); radiobutton.set("item 14",feedback_radiobutton,false,null,null,"F6","i"); var radiobutton = menu.addRadioButton(); radiobutton.set("item 15",feedback_radiobutton,false,null,null,"meta F7","t"); // add a separator at the last position or at a given index menu.addSeparator(); // and add some submenu's var submenu1 = menu.addSubMenu(); submenu1.set("submenu 17"); submenu1.addItem().set("sub item 17-00",globals.sampleMenuExec); var submenu2 = submenu1.addSubMenu(); submenu2.set("submenu 01"); submenu2.addItem().set("sub item 01-00",globals.sampleMenuExec); var submenu3 = submenu1.addSubMenu(); submenu3.set("submenu 02"); // add a separator at the last position or at a given index menu.addSeparator(); // WIZARD // You can use the menubar wizard solution found in application_server/solutions/servoy_wizard_menubar.servoy to create your menu // The wizard will help you at least to learn how to use the plugin and will help you to find the correct // accelerator key string
void
setAccelerator
(key)
Set the accelerator key of the item...
Parameters
key
Returns
void
Also see
External links
Sample
var menu = plugins.menubar.getMenu(2).getItem(0); // Set the text of the item... menu.setText("IT2Be"); // 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.setArguments(["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);
void
setArguments
(arguments)
Set the arguments that can be read by the defined method...
Parameters
arguments
Returns
void
Also see
External links
Sample
var menu = plugins.menubar.getMenu(2).getItem(0); // Set the text of the item... menu.setText("IT2Be"); // 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.setArguments(["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);
void
setEnabled
(enabled)
Enable/disable the item...
Parameters
enabled
Returns
void
Also see
External links
Sample
var menu = plugins.menubar.getMenu(2).getItem(0); // Set the text of the item... menu.setText("IT2Be"); // 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.setArguments(["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);
void
setIcon
(icon)
Set the icon of the item...
Parameters
icon
Returns
void
Also see
External links
Sample
var menu = plugins.menubar.getMenu(2).getItem(0); // Set the text of the item... menu.setText("IT2Be"); // 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.setArguments(["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);
void
setMnemonic
(key)
Set the mnemonic key of the item...
Parameters
key
Returns
void
Also see
External links
Sample
var menu = plugins.menubar.getMenu(2).getItem(0); // Set the text of the item... menu.setText("IT2Be"); // 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.setArguments(["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);
void
setVisible
(visible)
Set the item visible...
Parameters
visible
Returns
void
Also see
External links
Sample
var menu = plugins.menubar.getMenu(2).getItem(0); // Set the text of the item... menu.setText("IT2Be"); // 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.setArguments(["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);