{column:width=80px}{column}{column}{column}
Property Summary
{column:width=80px}{column}{column}{column}
Method Summary
addCheckBox(index)
Add the Checkbox at the selected index (starting at 0) or add it at the end (empty).
addRadioButton(index)
Add the Radiobutton at the selected index (starting at 0) or add it at the end (empty).
void
addRadioGroup()
Add a Radiogroup for the Radiobuttons.
void
addSeparator(index)
Add the separator at the selected index (starting at 0) or add it at the end (empty).
addSubMenu(index)
Add the submenu at the selected index (starting at 0) or add it at the end (empty).
void
doClick(click)
Script the selection (emulate a mouse click) of the menu.
getCheckBox(index)
Get the Checkbox at the selected index (starting at 0).
getItemCount()
Get the number of items in the menu.
getItemIndexByText(name)
Retrieve the index of the item by text.
getRadioButton(index)
Get the Radiobutton at the selected index (starting at 0).
getSubMenu(index)
Get the submenu at the selected index (starting at 0).
void
removeAllItems()
Remove all items from the menu.
void
removeItem(index 1, index 2-n)
Remove the item(s) at the selected index/indices.
void
set(text, mnemonic, enabled)
Set the menu with a text and optional mnemonic key.
void
setEnabled(enabled)
Set the the selected menu enabled or disabled.
void
setIcon(icon)
Set the icon of the menu.
void
setMnemonic(mnemonic)
Set the mnemonic of the selected menu.
{column:width=100%}{column}
Property Details
Replace with description
Parameters
Also see
External links
Sample
{column:width=100%}{column}
Method Details
addCheckBox
(index)
Add the Checkbox at the selected index (starting at 0) or add it at the end (empty)...
Parameters
[index]
Also see
External links
Sample
// Add the Checkbox at the selected index (starting at 0) or add it at the end (empty)... // 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 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("checkbox with feedback",feedback_checkbox); var checkbox = menu.addCheckBox(); // set the checkbox to selected checkbox.set("checkbox selected",feedback_checkbox, true); var checkbox = menu.addCheckBox(); // 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]; checkbox.set("checkbox with input",feedback_checkbox,false,input); var checkbox = menu.addCheckBox(); // add an icon to the item checkbox.set("checkbox with icon",feedback_checkbox,false,input,"media:///yourimage.gif"); var checkbox = menu.addCheckBox(); // add an accelerator key ('alt shift a' 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. checkbox.set("checkbox with accelerator",feedback_checkbox,false,input,"media:///yourimage.gif","alt shift a"); var checkbox = menu.addCheckBox(); // add a mnemonic key ('i' in our example) which is the underlined shortkey on windows // REMARK: setting the mnemonic key is platform dependent checkbox.set("checkbox with mnemonic",feedback_checkbox,false,input,"media:///yourimage.gif","a","i"); var checkbox = menu.addCheckBox(); // disable the menu item checkbox.set("checkbox disabled",feedback_checkbox,false,input,"media:///yourimage.gif","control 3","t",false); var checkbox = menu.addCheckBox(); // set the menu item to be visible checkbox.set("checkbox visible",feedback_checkbox,false,input,"media:///yourimage.gif","meta 4","e",true,true); var checkbox = menu.addCheckBox(); // set the menu item disabled and NOT visible checkbox.set("checkbox invisible",feedback_checkbox,false,input,"media:///yourimage.gif","alt 5","m",false,false); // add a separator at the last position or at a given index menu.addSeparator(); // WIZARD // You can use the menubar wizard Tools/Plugins/IT2Be help/Menubar Wizzzard to create you 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
addItem
(index)
Add the item at the selected index (starting at 0) or add it at the end (empty)...
Parameters
[index]
Also see
External links
Sample
// Add the item at the selected index (starting at 0) or add it at the end (empty)... // 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 Tools/Plugins/IT2Be help/Menubar Wizzzard to create you 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
addRadioButton
(index)
Add the Radiobutton at the selected index (starting at 0) or add it at the end (empty)...
Parameters
[index]
Also see
External links
Sample
// Add the Radiobutton at the selected index (starting at 0) or add it at the end (empty)... // 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); // add a new Radiobutton group // a group will 'bind' all added radiobuttons after the group together // as a result checking one item will uncheck the other menu.addRadioGroup(); // when you don't define an index the radiobutton will be added at the last position // this is what you usually do to build a new menu var radiobutton = menu.addRadioButton(); // 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 radiobutton.set("radiobutton with feedback",feedback_radiobutton); var radiobutton = menu.addRadioButton(); // set the radiobutton to selected radiobutton.set("radiobutton selected",feedback_radiobutton, true); var radiobutton = menu.addRadioButton(); // 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]; radiobutton.set("radiobutton with input",feedback_radiobutton,false,input); var radiobutton = menu.addRadioButton(); // add an icon to the item radiobutton.set("radiobutton with icon",feedback_radiobutton,false,input,"media:///yourimage.gif"); var radiobutton = menu.addRadioButton(); // add an accelerator key ('alt shift 3' 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. radiobutton.set("radiobutton with accelerator",feedback_radiobutton,false,input,"media:///yourimage.gif","alt shift 3"); // add a separator at the last position or at a given index menu.addSeparator(); // add a new Radiobutton group menu.addRadioGroup(); var radiobutton = menu.addRadioButton(); // add a mnemonic key ('i' in our example) which is the underlined shortkey on windows // REMARK: setting the mnemonic key is platform dependent radiobutton.set("radiobutton with mnemonic",feedback_radiobutton,false,input,"media:///yourimage.gif","a","i"); var radiobutton = menu.addRadioButton(); // disable the menu item radiobutton.set("radiobutton disabled",feedback_radiobutton,false,input,"media:///yourimage.gif","control 3","t",false); var radiobutton = menu.addRadioButton(); // set the menu item to be visible radiobutton.set("radiobutton visible",feedback_radiobutton,true,input,"media:///yourimage.gif","meta 4","e",true,true); var radiobutton = menu.addRadioButton(); // now the item is enabled and NOT visible radiobutton.set("radiobutton invisible",feedback_radiobutton,false,input,"media:///yourimage.gif","alt 5","m",true,false); // add a separator at the last position or at a given index menu.addSeparator(); // WIZARD // You can use the menubar wizard Tools/Plugins/IT2Be help/Menubar Wizzzard to create you 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
addRadioGroup
()
Add a Radiogroup for the Radiobuttons...
Parameters
Returns
void
Also see
External links
Sample
// Add a Radiogroup for the Radiobuttons... // 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); // add a new Radiobutton group // a group will 'bind' all added radiobuttons after the group together // as a result checking one item will uncheck the other menu.addRadioGroup(); // when you don't define an index the radiobutton will be added at the last position // this is what you usually do to build a new menu var radiobutton = menu.addRadioButton(); // 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 radiobutton.set("radiobutton with feedback",feedback_radiobutton); var radiobutton = menu.addRadioButton(); // set the radiobutton to selected radiobutton.set("radiobutton selected",feedback_radiobutton, true); var radiobutton = menu.addRadioButton(); // 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]; radiobutton.set("radiobutton with input",feedback_radiobutton,false,input); var radiobutton = menu.addRadioButton(); // add an icon to the item radiobutton.set("radiobutton with icon",feedback_radiobutton,false,input,"media:///yourimage.gif"); var radiobutton = menu.addRadioButton(); // add an accelerator key ('alt shift 3' 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. radiobutton.set("radiobutton with accelerator",feedback_radiobutton,false,input,"media:///yourimage.gif","alt shift 3"); // add a separator at the last position or at a given index menu.addSeparator(); // add a new Radiobutton group menu.addRadioGroup(); var radiobutton = menu.addRadioButton(); // add a mnemonic key ('i' in our example) which is the underlined shortkey on windows // REMARK: setting the mnemonic key is platform dependent radiobutton.set("radiobutton with mnemonic",feedback_radiobutton,false,input,"media:///yourimage.gif","a","i"); var radiobutton = menu.addRadioButton(); // disable the menu item radiobutton.set("radiobutton disabled",feedback_radiobutton,false,input,"media:///yourimage.gif","control 3","t",false); var radiobutton = menu.addRadioButton(); // set the menu item to be visible radiobutton.set("radiobutton visible",feedback_radiobutton,true,input,"media:///yourimage.gif","meta 4","e",true,true); var radiobutton = menu.addRadioButton(); // now the item is enabled and NOT visible radiobutton.set("radiobutton invisible",feedback_radiobutton,false,input,"media:///yourimage.gif","alt 5","m",true,false); // add a separator at the last position or at a given index menu.addSeparator(); // WIZARD // You can use the menubar wizard Tools/Plugins/IT2Be help/Menubar Wizzzard to create you 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
addSeparator
(index)
Add the separator at the selected index (starting at 0) or add it at the end (empty)...
Parameters
[index]
Returns
void
Also see
External links
Sample
// Add the separator at the selected index (starting at 0) or add it at the end (empty)... plugins.menubar.getMenu(0).addSeparator();
addSubMenu
(index)
Add the submenu at the selected index (starting at 0) or add it at the end (empty)...
Parameters
[index]
Also see
External links
Sample
void
doClick
(click)
Script the selection (emulate a mouse click) of the menu...
Parameters
click
Returns
void
Also see
External links
Sample
// Script the selection (emulate a mouse click) of the menu... plugins.menubar.getMenu(0).doClick();
getCheckBox
(index)
Get the Checkbox at the selected index (starting at 0)...
Parameters
index
Also see
External links
Sample
// Get the Checkbox at the selected index (starting at 0)... // get the menu at the last position // indexes start at 0 (zero) so index 2 is in fact position 3 var menu = plugins.menubar.getMenu(plugins.menubar.getMenuCount() - 1); var checkbox = menu.getCheckBox(0); checkbox.setText("Changed menu item"); // REMARK: we actually changed an original menu (item)! As a result resetting the // menubar will NOT reset the above changes. We need to reset the menu (item) // manually the following way: // get the menu // var menu = plugins.menubar.getMenu(2); // get the item // var item = menu.getItem(0); // reset the values to default // notice we use an i18n message here the same way you would use it with // standard Servoy methods and plugins // item.setText("i18n:servoy.menuitem.viewAsRecord");
getItem
(index)
Get the item at the selected index (starting at 0)...
Parameters
index
Also see
External links
Sample
// Get the item at the selected index (starting at 0)... // get the menu at the last position // indexes start at 0 (zero) so index 2 is in fact position 3 var menu = plugins.menubar.getMenu(plugins.menubar.getMenuCount() - 1); var item = menu.getItem(0); item.setText("Changed menu item"); // REMARK: we actually changed an original menu (item)! As a result resetting the // menubar will NOT reset the above changes. We need to reset the menu (item) // manually the following way: // get the menu // var menu = plugins.menubar.getMenu(2); // get the item // var item = menu.getItem(0); // reset the values to default // notice we use an i18n message here the same way you would use it with // standard Servoy methods and plugins // item.setText("i18n:servoy.menuitem.viewAsRecord");
getItemCount
()
Get the number of items in the menu...
Parameters
Also see
External links
Sample
// Get the number of items in the menu... // REMARK: indexes start at 0, disabled items, non visible items and seperators are counted also // REMARK: this is especially important when getting items by the index application.output(plugins.menubar.getMenu(0).getItemCount());
getItemIndexByText
(name)
Retrieve the index of the item by text...
Parameters
name
Also see
External links
Sample
getRadioButton
(index)
Get the Radiobutton at the selected index (starting at 0)...
Parameters
index
Also see
External links
Sample
// Get the Radiobutton at the selected index (starting at 0)... // get the menu at the last position // indexes start at 0 (zero) so index 2 is in fact position 3 var menu = plugins.menubar.getMenu(plugins.menubar.getMenuCount() - 1); var checkbox = menu.getItem(0); checkbox.setText("Changed menu item"); // REMARK: we actually changed an original menu (item)! As a result resetting the // menubar will NOT reset the above changes. We need to reset the menu (item) // manually the following way: // get the menu // var menu = plugins.menubar.getMenu(2); // get the item // var item = menu.getItem(0); // reset the values to default // notice we use an i18n message here the same way you would use it with // standard Servoy methods and plugins // item.setText("i18n:servoy.menuitem.viewAsRecord");
getSubMenu
(index)
Get the submenu at the selected index (starting at 0)...
Parameters
index
Also see
External links
Sample
void
removeAllItems
()
Remove all items from the menu...
Parameters
Returns
void
Also see
External links
Sample
// Remove all items from the menu... // 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); // remove all menu items from the selected menu menu.removeAllItems();
void
removeItem
(index 1, index 2-n)
Remove the item(s) at the selected index/indices...
Parameters
index 1
[index 2-n]
Returns
void
Also see
External links
Sample
// Remove the item(s) at the selected index/indices... // 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); // remove only one item at the selected index // from the selected menu // menu.removeItem(0); // remove more than one item at the selected indices // from the selected menu menu.removeItem(1,2);
void
set
(text, mnemonic, enabled)
Set the menu with a text and optional mnemonic key. The menu is enabled by default...
Parameters
text
[mnemonic]
[enabled]
Returns
void
Also see
External links
Sample
// add a menu at the given index // when you don't define an index the menu will be added at the last // positon of the menubar var menu = plugins.menubar.addMenu(); // set the text of the menu at the chose position menu.setText("add menu"); // set the mnemonic key menu.setMnemonic("a"); // disable the menu menu.setEnabled(true); // another way of doing the same thing would have been to use // the set() method menu.set("add menu", "a", true); // REMARK: normally you would add menu items, checkboxes etc in the same method // this example will show no menu items for now! // IMPORTANT: Working with menu's on developer and client can differ // WIZARD // You can use the menubar wizard Tools/Plugins/IT2Be help/Menubar Wizzzard to create you 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
setEnabled
(enabled)
Set the the selected menu enabled or disabled...
Parameters
enabled
Returns
void
Also see
External links
Sample
// Set the the selected menu enabled or disabled... var menu = plugins.menubar.getMenu(0); menu.setText("Hello"); menu.setMnemonic("H"); menu.setEnabled(false);
void
setIcon
(icon)
Set the icon of the menu...
Parameters
icon
Returns
void
Also see
External links
Sample
void
setMnemonic
(mnemonic)
Set the mnemonic of the selected menu...
Parameters
mnemonic
Returns
void
Also see
External links
Sample
// Set the mnemonic of the selected menu... var menu = plugins.menubar.getMenu(0); menu.setText("Hello"); menu.setMnemonic("H"); menu.setEnabled(false);