# Sub menu

**URL:** <https://forum.inductiveautomation.com/t/sub-menu/4915>\
**Category:** Ignition\
**Created:** [August 1, 2012, 7:08pm UTC](https://forum.inductiveautomation.com/t/sub-menu/4915 "2012-08-01T19:08:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![cacordova](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@cacordova](https://forum.inductiveautomation.com/u/cacordova)\
**Post date:** [August 1, 2012, 7:08pm UTC](https://forum.inductiveautomation.com/t/sub-menu/4915/1 "2012-08-01T19:08:38Z")

</div>

Hello,

I would just like to ask if creating a sub pop up menu possible and how?

Thank You 😃

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [August 1, 2012, 8:05pm UTC](https://forum.inductiveautomation.com/t/sub-menu/4915/2 "2012-08-01T20:05:35Z")

</div>

Yes, it is possible through scripting. We have a built-in function, system.gui.createPopupMenu, that will create a popup menu. Usually, people use it for a right click menu but it can be used for multiple purposes.

Here is an example:[code]names = []  
funcs = []

names.append(“Menu Item 1”)  
def doMenuItem1(event):  
import system  
system.gui.messageBox(“Menu item 1 selected”)  
funcs.append(doMenuItem1)

menu = system.gui.createPopupMenu(names, funcs)  
menu.show(event)[/code]That is for a right click menu that you can put in the mouseReleased event handler. If you want it to popup for a left click on any event do this at the end:`menu.show(event, 100, 100)`using an x and y.

Here is some more information on the function:

[http://www.inductiveautomation.com/support/usermanuals/ignition/system\_gui\_createpopupmenu.htm](http://www.inductiveautomation.com/support/usermanuals/ignition/system_gui_createpopupmenu.htm)

---

<div class="post-metadata">

**Author:** ![cacordova](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@cacordova](https://forum.inductiveautomation.com/u/cacordova)\
**Post date:** [August 2, 2012, 2:57pm UTC](https://forum.inductiveautomation.com/t/sub-menu/4915/3 "2012-08-02T14:57:29Z")

</div>

I’m a little new at this, why is names and funcs equal to []?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [August 2, 2012, 3:06pm UTC](https://forum.inductiveautomation.com/t/sub-menu/4915/4 "2012-08-02T15:06:23Z")

</div>

Those lines are just creating new lists (array). Then we can add stuff to the lists through list.append().

---

<div class="post-metadata">

**Author:** ![cacordova](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@cacordova](https://forum.inductiveautomation.com/u/cacordova)\
**Post date:** [August 2, 2012, 3:30pm UTC](https://forum.inductiveautomation.com/t/sub-menu/4915/5 "2012-08-02T15:30:08Z")

</div>

Oh I see, I’d like to ask if it’s also possible to add html codes in ignition?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [August 2, 2012, 4:19pm UTC](https://forum.inductiveautomation.com/t/sub-menu/4915/6 "2012-08-02T16:19:26Z")

</div>

Yes, just add “” to the beginning of your strings.

---

<div class="post-metadata">

**Author:** ![cacordova](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@cacordova](https://forum.inductiveautomation.com/u/cacordova)\
**Post date:** [August 2, 2012, 5:04pm UTC](https://forum.inductiveautomation.com/t/sub-menu/4915/7 "2012-08-02T17:04:30Z")

</div>

oh ok, i have this html code for this button (shown on the picture). what type of component/tool can i paste it on to be able to view that button onto the ignition window?  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b0b7fac3a806e9794e56685f1014d3cc8210b0c1.JPG)

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [August 2, 2012, 5:24pm UTC](https://forum.inductiveautomation.com/t/sub-menu/4915/8 "2012-08-02T17:24:04Z")

</div>

You can use a button or a label component. Just set the text to your html string. It must start with .

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 15, 2017, 1:02am UTC](https://forum.inductiveautomation.com/t/sub-menu/4915/9 "2017-11-15T01:02:31Z")

</div>

This “menu.show(event, x, y)” part should definitely be added into the documentation… there is no mention that you can use this function for left click actions anywhere!

Just FYI to anyone else who finds this here and is also confused as I was: the x and y are mouse coordinate **offsets** from the coordinates of the origin of the object that triggered the popup script.
