popup menu show() error

I have what seems to be a simple error trying to create a popup menu. I can get the menu to be created and shown if I use the code shown below when showing it using the hard coded coordinates (10,10) for instance.
But when I copy code from the Wiki to display the menu just below the object to which the method is attached, I get the following error:

ReferenceError: “event” is not defined.

This error occurs on the line: var source = event.getSource()

Maybe there is something simple I am overlooking, but I was hoping to just copy this little bit of code from the Wiki and have it working.

Another interesting issue is that I don’t see the mnemonic key getting displayed in an underlined manner. I have set this as parameter #4 of the addMenuItem function for a few of these menu items.

My configuration:
MacOSX 10.6.4
Servoy 5.2.2 SmartClient

function toolmenu_mpr_ppm() {
	var ppMenu = plugins.window.createPopupMenu();
	var menuitem0 = ppMenu.addMenuItem('BackColor', null, null, 'b');
	var menuitem1 = ppMenu.addMenuItem('Red', null, null, 'r');
	var menuitem2 = ppMenu.addMenuItem('Green', null, null, 'g');
	var menuitem3 = ppMenu.addMenuItem('Blue', null, null, 'b');
	var menuitem4 = ppMenu.addMenuItem('White', null, null, 'w');
	//show popup menu
	var source = event.getSource()
	if (source != null) {
		ppMenu.show(source);
	}
	//    ppMenu.show(10,10);

}

try this:

function toolmenu_mpr_ppm(event) {
 // the rest of code
}

you need the receive the ‘event’ first…

Mnemonics don’t work on the mac platform.

Harjo, Dave - thanks for your help - this works great now. And I won’t worry about the menu mnemonic on MacOSX anymore either.

I’m trying to use mnemonics on a popupMenu on WindowsXP. I was hoping I could display the popupMenu with mnemonics showing so the user could use their keyboard to select menu items, but on Windows the mnemonics only show up when you hold down the alt key and as soon as I hit the alt key, the popup disappears.

Is there no way to display and use mnemonics on a popup menu?

Thanks.