# popup menu show() error

**URL:** https://forum.servoy.com/t/popup-menu-show-error/13381
**Category:** Classic Servoy
**Created:** [December 30, 2010, 5:27am UTC](https://forum.servoy.com/t/popup-menu-show-error/13381 "2010-12-30T05:27:53Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![dsimpson](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@dsimpson](https://forum.servoy.com/u/dsimpson)
#### Post date: [December 30, 2010, 5:27am UTC](https://forum.servoy.com/t/popup-menu-show-error/13381/1 "2010-12-30T05:27:53Z")

</div>

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

```auto
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);

}

```

---

<div class="post-metadata">

### Author: ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)
#### Post date: [December 30, 2010, 2:10pm UTC](https://forum.servoy.com/t/popup-menu-show-error/13381/2 "2010-12-30T14:10:42Z")

</div>

try this:

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

```

you need the receive the ‘event’ first…

---

<div class="post-metadata">

### Author: ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)
#### Post date: [December 30, 2010, 4:34pm UTC](https://forum.servoy.com/t/popup-menu-show-error/13381/3 "2010-12-30T16:34:27Z")

</div>

Mnemonics don’t work on the mac platform.

---

<div class="post-metadata">

### Author: ![dsimpson](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@dsimpson](https://forum.servoy.com/u/dsimpson)
#### Post date: [December 30, 2010, 7:57pm UTC](https://forum.servoy.com/t/popup-menu-show-error/13381/4 "2010-12-30T19:57:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![amcgilly](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@amcgilly](https://forum.servoy.com/u/amcgilly)
#### Post date: [May 2, 2013, 4:46am UTC](https://forum.servoy.com/t/popup-menu-show-error/13381/5 "2013-05-02T04:46:42Z")

</div>

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.
