Close/cancels the current form popup panel without assigning a value to the configured data provider.
Example:
// Show a form as popup panel, where the closeFormPopup can pass return a value to a dataprovider in the specified scope.plugins.window.showFormPopup(null,forms.orderPicker,foundset.getSelectedRecord(),"order_id");// plugins.window.showFormPopup(null,forms.orderPicker,foundset.getSelectedRecord(),"order_id",-1,-1,100,100,true, false, onClose);//// function onClose(event) {application.output("Popup closed");}
closeFormPopup(retval)
Close the current form popup panel and assign the value to the configured data provider.
Example:
// Show a form as popup panel, where the closeFormPopup can pass return a value to a dataprovider in the specified scope.plugins.window.showFormPopup(null,forms.orderPicker,foundset.getSelectedRecord(),"order_id");// plugins.window.showFormPopup(null,forms.orderPicker,foundset.getSelectedRecord(),"order_id",-1,-1,100,100,true, false, onClose);//// function onClose(event) {application.output("Popup closed");}
Creates a new popup menu, either empty, or initialized from an existing JSMenu.
Example:
// create a popup menu// var menu = plugins.window.createPopupMenu(menus.getMenu('contextMenu'), feedback);var menu =plugins.window.createPopupMenu();// add a menu itemmenu.addMenuItem("an entry", callback);if (event.getSource()) {// display the popup over the component which is the source of the eventmenu.show(event.getSource());// display the popup over the components, at specified coordinates relative to the component//menu.show(event.getSource(), 10, 10);// display the popup at specified coordinates relative to the main window//menu.show(100, 100);}
Parameters:
{JSMenu} [menu] The JSMenu whose structure will be used to initialize the popup menu.
{function} [callback] The menu item click handler that will be set on all popup menu items. The callback signature is: function(itemIndex:number, parentIndex: number, isSelected: boolean, parentMenu: String, menu: String)
// this plugin uses the java keystroke parser// see http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/KeyStroke.html#getKeyStroke(java.lang.String)// global handlerplugins.window.createShortcut('control shift I',scopes.globals.handleOrdersShortcut);// global handler with a form context filterplugins.window.createShortcut('control shift I',scopes.globals.handleOrdersShortcut,'frm_contacts');// form method called when shortcut is usedplugins.window.createShortcut('control RIGHT',forms.frm_contacts.handleMyShortcut);// form method called when shortcut is used and arguments are passed to the methodplugins.window.createShortcut('control RIGHT',forms.frm_contacts.handleMyShortcut,newArray(argument1, argument2));// Passing the method argument as a string prevents unnecessary form loading//plugins.window.createShortcut('control RIGHT', 'frm_contacts.handleMyShortcut', new Array(argument1, argument2));// Passing the method as a name and the contextFilter set so that this shortcut only trigger on the form 'frm_contacts'.plugins.window.createShortcut('control RIGHT','frm_contacts.handleMyShortcut','frm_contacts',newArray(argument1, argument2));// Num Lock and Substract shortcutsplugins.window.createShortcut("NUMPAD8", handleMyShortcut);plugins.window.createShortcut("SUBTRACT", handleMyShortcut);// remove global shortcut and form-level shortcutplugins.window.removeShortcut('menu 1');plugins.window.removeShortcut('control RIGHT','frm_contacts');// consuming they keystroke so that a default browser event will not happenplugins.window.createShortcut('F4',scopes.globals.handleOrdersShortcut,'frm_contacts',null,true);// shortcut handlers are called with an JSEvent argument///*// * Handle keyboard shortcut.// *// * @param {JSEvent} event the event that triggered the action// *///function handleShortcut(event)//{// application.output(event.getType()) // returns 'menu 1'// application.output(event.getFormName()) // returns 'frm_contacts'// application.output(event.getElementName()) // returns 'contact_name_field' or null when no element is selected//}// NOTES:// 1) shortcuts will not override existing operating system or browser shortcuts,// choose your shortcuts carefully to make sure they work in all clients.// 2) always use lower-case letters for modifiers (shift, control, etc.), otherwise createShortcut will fail.
{function} callback Scopes.scopename.methodname or formname.methodname String to target the method to execute
{string} [contextFilter] ContextFilter form or element name ( ng only - specified by formName.elementName); only triggers the shortcut when on this form/element
{boolean} [consumeEvent] ConsumeEvent if true then the shotcut will consume the event and the default browser behavior will not be executed (default false)
{string} [contextFilter] ContextFilter form or element name ( ng only - specified by formName.elementName); only triggers the shortcut when on this form/element
Show a form as popup panel, where the closeFormPopup can pass return a value to a dataprovider in the specified scope.
Can show relative to a component or at specified coordinates.
Show on specified location and backdrop is only supported in NGClient.
Example:
// Show a form as popup panel, where the closeFormPopup can pass return a value to a dataprovider in the specified scope.plugins.window.showFormPopup(null,forms.orderPicker,foundset.getSelectedRecord(),"order_id");// plugins.window.showFormPopup(null,forms.orderPicker,foundset.getSelectedRecord(),"order_id",-1,-1,100,100,true, false, onClose);//// function onClose(event) {application.output("Popup closed");}
Parameters:
{runtimecomponent} component ElementToShowRelatedTo element to show related to or null to center in screen
Returns:function FormPopup itself if it's used as a setter or the dataprovider value if no argument is given
onClose(onClose)
Set the onclose function that is called when the closeFormPopup is called.
This onClose will get a JSEvent as the first argument, and the return value that is given to the closeFormPopup(retvalue) call.
Script the selection (emulate a mouse click) of the menu.
Example:
// simulate a click on the popup menumenu.doClick();
setEnabled(enabled)
Set the the selected menu enabled or disabled.
Example:
var popup =plugins.window.createPopupMenu();var menu =popup.addMenu();// set the menu's textmenu.text ="New Menu";// disable the menumenu.setEnabled(false);// set a mnemonicmenu.setMnemonic("u");// add an icon to the menumenu.setIcon("media:///yourimage.gif");
var popup =plugins.window.createPopupMenu();var menu =popup.addMenu();// set the menu's textmenu.text ="New Menu";// disable the menumenu.setEnabled(false);// set a mnemonicmenu.setMnemonic("u");// add an icon to the menumenu.setIcon("media:///yourimage.gif");
var popup =plugins.window.createPopupMenu();var menu =popup.addMenu();// set the menu's textmenu.text ="New Menu";// disable the menumenu.setEnabled(false);// set a mnemonicmenu.setMnemonic("u");// add an icon to the menumenu.setIcon("media:///yourimage.gif");
Script the selection (emulate a mouse click) of the item.
Example:
// create a popup menuvar menu =plugins.window.createPopupMenu();// add a menu itemvar entry =menu.addMenuItem("menu entry", feedback);// alternatively add a checkbox//var entry = menu.addCheckBox("menu entry", feedback);// or alternatively add a radiobutton//var entry = menu.addRadioButton("menu entry", feedback);// simulate a click on the entryentry.doClick();
getClientProperty(key)
Gets the specified client property for the menu item/checkbox/radiobutton based on a key.
Example:
// add a new menu to the menubarvar menubar =plugins.window.getMenuBar();var menu =menubar.addMenu();menu.text ="New Menu";// alternatively create a popup menu//var menu = plugins.window.createPopupMenu();// add a menu itemvar entry =menu.addMenuItem("menu entry", feedback);// alternatively add a checkbox//var entry = menu.addCheckBox("menu entry", feedback);// or alternatively add a radiobutton//var entry = menu.addRadioButton("menu entry", feedback);// NOTE: Depending on the operating system, a user interface property name may be available.// set the tooltip of the menu item/checkbox/radiobutton via client properties// keep the original tooltip in a form or global variableoriginalTooltip =entry.getClientProperty("ToolTipText");entry.putClientProperty("ToolTipText","changed tooltip");// later restore the original tooltip from the variable//var menubar = plugins.window.getMenuBar();//var menuIndex = menubar.getMenuIndexByText("New Menu");//var menu = menubar.getMenu(menuIndex);//var entry = menu.getItem(0);//entry.putClientProperty("ToolTipText", originalTooltip);
Sets the value for the specified client property key of the menu item/checkbox/radiobutton.
Example:
// add a new menu to the menubarvar menubar =plugins.window.getMenuBar();var menu =menubar.addMenu();menu.text ="New Menu";// alternatively create a popup menu//var menu = plugins.window.createPopupMenu();// add a menu itemvar entry =menu.addMenuItem("menu entry", feedback);// alternatively add a checkbox//var entry = menu.addCheckBox("menu entry", feedback);// or alternatively add a radiobutton//var entry = menu.addRadioButton("menu entry", feedback);// NOTE: Depending on the operating system, a user interface property name may be available.// set the tooltip of the menu item/checkbox/radiobutton via client properties// keep the original tooltip in a form or global variableoriginalTooltip =entry.getClientProperty("ToolTipText");entry.putClientProperty("ToolTipText","changed tooltip");// later restore the original tooltip from the variable//var menubar = plugins.window.getMenuBar();//var menuIndex = menubar.getMenuIndexByText("New Menu");//var menu = menubar.getMenu(menuIndex);//var entry = menu.getItem(0);//entry.putClientProperty("ToolTipText", originalTooltip);
Set the accelerator key of the menu item/checkbox/radiobutton.
Example:
// add a new menu to the menubarvar menubar =plugins.window.getMenuBar();var menu =menubar.addMenu();menu.text ="New Menu";// alternatively create a popup menu//var menu = plugins.window.createPopupMenu();// add a menu itemvar entry =menu.addMenuItem("menu entry", feedback);// alternatively add a checkbox//var entry = menu.addCheckBox("menu entry", feedback);// or alternatively add a radiobutton//var entry = menu.addRadioButton("menu entry", feedback);// define an accelerator for the menu entryentry.setAccelerator("ctrl alt Y");// also define a mnemonicentry.setMnemonic("y");// set a custom background colorentry.setBackgroundColor("#111111");// set a custom foreground colorentry.setForegroundColor("#EE5555");// set an iconentry.setIcon("media:///yourimage.gif");
Set the icon of the menu item/checkbox/radiobutton.
Example:
// add a new menu to the menubarvar menubar =plugins.window.getMenuBar();var menu =menubar.addMenu();menu.text ="New Menu";// alternatively create a popup menu//var menu = plugins.window.createPopupMenu();// add a menu itemvar entry =menu.addMenuItem("menu entry", feedback);// alternatively add a checkbox//var entry = menu.addCheckBox("menu entry", feedback);// or alternatively add a radiobutton//var entry = menu.addRadioButton("menu entry", feedback);// define an accelerator for the menu entryentry.setAccelerator("ctrl alt Y");// also define a mnemonicentry.setMnemonic("y");// set a custom background colorentry.setBackgroundColor("#111111");// set a custom foreground colorentry.setForegroundColor("#EE5555");// set an iconentry.setIcon("media:///yourimage.gif");
Set the method for the menu item/checkbox/radiobutton.
Example:
// add a new menu to the menubarvar menubar =plugins.window.getMenuBar();var menu =menubar.addMenu();menu.text ="New Menu";// alternatively create a popup menu//var menu = plugins.window.createPopupMenu();// add a menu item at the first position in the menuvar entry =menu.addMenuItem(0);// alternatively add a checkbox at the first position//var entry = menu.addCheckBox(0);// or alternatively add a radiobutton at the first position//var entry = menu.addRadioButton(0);// disable the newly added entryentry.enabled =false;// give a name to the entry (the name is not visible anywhere)entry.name ="my_name";// make the entry selected (affects checkboxes and radiobuttons)entry.selected =true;// set the text of the entryentry.text ="menu entry";// set the callback methodentry.setMethod(feedback);// set the arguments to be sent to the callback method// (an array of elements which will be passed as arguments 5, 6 and so on to the callback method)// the first 5 arguments are fixed: // [0] item index// [1] parent item index// [2] isSelected boolean// [3] parent menu text// [4] menu textentry.methodArguments = [17,"data"];
Set the icon of the menu item/checkbox/radiobutton.
Example:
// add a new menu to the menubarvar menubar =plugins.window.getMenuBar();var menu =menubar.addMenu();menu.text ="New Menu";// alternatively create a popup menu//var menu = plugins.window.createPopupMenu();// add a menu itemvar entry =menu.addMenuItem("menu entry", feedback);// alternatively add a checkbox//var entry = menu.addCheckBox("menu entry", feedback);// or alternatively add a radiobutton//var entry = menu.addRadioButton("menu entry", feedback);// define an accelerator for the menu entryentry.setAccelerator("ctrl alt Y");// also define a mnemonicentry.setMnemonic("y");// set a custom background colorentry.setBackgroundColor("#111111");// set a custom foreground colorentry.setForegroundColor("#EE5555");// set an iconentry.setIcon("media:///yourimage.gif");
// add a new menu to the menubarvar menubar =plugins.window.getMenuBar();var menu =menubar.addMenu();menu.text ="New Menu";// alternatively create a popup menu//var menu = plugins.window.createPopupMenu();// add a menu itemvar entry_one =menu.addMenuItem("an entry", feedback);// add a checkboxvar entry_two =menu.addCheckBox("another entry", feedback);// add a radiobuttonvar entry_three =menu.addRadioButton("yet another entry", feedback);// hide the menu itementry_one.setVisible(false);// make sure the checkbox is visibleentry_two.setVisible(true);// hide the radiobuttonentry_three.setVisible(false);
Show the popup menu relative to the specified component.
If there is not enough space above or under the component, the behavior is undefined (the browser will decide how menu is displayed)
Example:
// create a popup menuvar menu =plugins.window.createPopupMenu();// add a menu itemmenu.addMenuItem("an entry", feedback);if (event.getSource()) {// display the popup over the component which is the source of the eventmenu.show(event.getSource(),true);}
Parameters:
runtimecomponent component The component where this popup is linked in
boolean [positionTop] The positionTop where to show the popup (default false)
show(component,x,y,positionTop)
Show the popup menu at the specified location.
If positionTop is true, and there is enough room available, then popup menu's bottom - left corner is ending at the specified coordinates;
x, y values are relative to top-left corner of the component.
By default, positionTop is false.
If there is not enough space above or under the component, the behavior is undefined (the browser will decide how menu is displayed)
Example:
// create a popup menuvar menu =plugins.window.createPopupMenu();// add a menu itemmenu.addMenuItem("an entry", feedback);if (event.getSource()) {// display the popup over the component which is the source of the event// display the popup over the components, at specified coordinates relative to the component//menu.show(event.getSource(), 10, 10, true);}
Parameters:
runtimecomponent component The component where this popup is linked in
boolean [positionTop] The positionTop where to show the popup (default false)
show(event)
Show the popup menu relative to the event's source
Example:
// create a popup menuvar menu =plugins.window.createPopupMenu();// add a menu itemmenu.addMenuItem("an entry", feedback);if (event.getSource()) {// display the popup over the component which is the source of the event// display the popup over the components, at specified coordinates relative to the component//menu.show(event.getSource());}
// create a popup menuvar menu =plugins.window.createPopupMenu();// add a menu itemmenu.addMenuItem("an entry", feedback);if (event.getSource()) {// display the popup over the component which is the source of the event// display the popup over the components, at specified coordinates relative to the component//menu.show(event.getSource(), 10, 10, true);}