I want to create a very simple popup menu but cannot get it to work.
I have a button on my form (name= ‘pop’) and a method attached to it.
This is my code:
var menu = new Array(
plugins.popupmenu.createMenuItem(‘A’,myMethod),
plugins.popupmenu.createRadioButtonMenuItem(‘B’,myMethod)
)
var elem = forms[application.getMethodTriggerFormName()].elements[application.getMethodTriggerElementName()]
if (elem != null)
{plugins.popupmenu.showPopupMenu(elem, menu)}
The error message says: Reference error: can’t find myMethod.
But lets forget my code, I have no special reason with my coding I am
just trying to popup something, without exacly knowing how things work.
The Servoy sample has to many bells and wishles for me.
So basically I just want a very simple piece of code, with 2 menu-items calling a method, that works, thats all.
From there I want to explore the possibilties myself…
Thanks.
// Lets define 2 menuitems that don't trigger any methods
var aMenu = new Array(
plugins.popupmenu.createMenuItem('Item 1',null),
plugins.popupmenu.createMenuItem('Item 2',null)
)
// Get the form element name that triggered this method
// Make sure the element does HAVE a name in the name property
var sElementName = elements[application.getMethodTriggerElementName()]
if (sElementName != null) {
// we have a name, lets show the popup right under this element.
plugins.popupmenu.showPopupMenu(sElementName, aMenu);
}