# Pop-up list incorrect order

**URL:** <https://forum.inductiveautomation.com/t/pop-up-list-incorrect-order/47466>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [June 4, 2021, 4:02pm UTC](https://forum.inductiveautomation.com/t/pop-up-list-incorrect-order/47466 "2021-06-04T16:02:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![miles.brim](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@miles.brim](https://forum.inductiveautomation.com/u/miles.brim)\
**Post date:** [June 4, 2021, 4:02pm UTC](https://forum.inductiveautomation.com/t/pop-up-list-incorrect-order/47466/1 "2021-06-04T16:02:16Z")

</div>

I have the following code in onPopupTrigger in an Equipment Schedule Object:

menu = system.gui.createPopupMenu({‘1.Show Sunday’:ShowSunday,‘2.Show Monday’:ShowMonday,‘3.Show Tuesday’:ShowTuesday,‘4.Show Wednesday’:ShowWednesday,‘5.Show Thursday’:ShowThursday,‘6.Show Friday’:ShowFriday,‘7.Show Saturday’:ShowSaturday})  
menu.show(event)

I want the pop-up to display in the order in the menu (Sunday, Monday, Tuesday, etc.)  
however, when I right click in the the object, it shows it as Monday, Tuesday, Saturday, Thursday…  
I tried adding the numbers in front of each menu item to see if that would force it to appear in the correct order.

How can I make it appear in the correct order?  
Thanks

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 4, 2021, 4:16pm UTC](https://forum.inductiveautomation.com/t/pop-up-list-incorrect-order/47466/2 "2021-06-04T16:16:45Z")

</div>

Don’t use a dictionary. Python and Jython dictionaries don’t maintain the order of the items they contain. Use lists, as shown in the manual.

---

<div class="post-metadata">

**Author:** ![miles.brim](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@miles.brim](https://forum.inductiveautomation.com/u/miles.brim)\
**Post date:** [June 4, 2021, 4:25pm UTC](https://forum.inductiveautomation.com/t/pop-up-list-incorrect-order/47466/3 "2021-06-04T16:25:15Z")

</div>

When I change it to [‘1. ShowMonday’,ShowMonday,…], I get the following error:

10:23:03.365 [AWT-EventQueue-0] ERROR Vision.EquipmentScheduleView - Error invoking extension method.  
org.python.core.PyException: Traceback (most recent call last):  
File “”, line 56, in onPopupTrigger  
TypeError: createPopupMenu(): 1st arg can’t be coerced to org.python.core.PyDictionary

How do I need to format a list to enter it into createPopupMenu()?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 4, 2021, 4:26pm UTC](https://forum.inductiveautomation.com/t/pop-up-list-incorrect-order/47466/4 "2021-06-04T16:26:41Z")

</div>

Two separate lists. One of names, one of corresponding functions. As shown [in the manual](https://docs.inductiveautomation.com/display/DOC81/system.gui.createPopupMenu).

---

<div class="post-metadata">

**Author:** ![miles.brim](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@miles.brim](https://forum.inductiveautomation.com/u/miles.brim)\
**Post date:** [June 4, 2021, 4:33pm UTC](https://forum.inductiveautomation.com/t/pop-up-list-incorrect-order/47466/5 "2021-06-04T16:33:38Z")

</div>

Ah, yes, the manual… This worked. The default example provides a dictionary, which is what led me astray.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 4, 2021, 4:37pm UTC](https://forum.inductiveautomation.com/t/pop-up-list-incorrect-order/47466/6 "2021-06-04T16:37:56Z")

</div>

> [@miles.brim](#):
>
> The default example provides a dictionary

Where'd you see that? The manual has no such example.

---

<div class="post-metadata">

**Author:** ![miles.brim](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@miles.brim](https://forum.inductiveautomation.com/u/miles.brim)\
**Post date:** [June 4, 2021, 4:39pm UTC](https://forum.inductiveautomation.com/t/pop-up-list-incorrect-order/47466/7 "2021-06-04T16:39:45Z")

</div>

When you bring in a new Equipment Schedule, this is the default in onPopupTrigger:

```
 Example for displaying a popup menu:
def showInfo(evt):
	system.gui.messageBox('You clicked on item %s' % itemId)
menu = system.gui.createPopupMenu({'Item Info':showInfo})
menu.show(event)
```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 4, 2021, 4:46pm UTC](https://forum.inductiveautomation.com/t/pop-up-list-incorrect-order/47466/8 "2021-06-04T16:46:58Z")

</div>

Ah. Never noticed. Might want to ding Sepasoft for that.

---

<div class="post-metadata">

**Author:** ![TimE](https://avatars.discourse-cdn.com/v4/letter/t/ee59a6/32.png) [@TimE](https://forum.inductiveautomation.com/u/TimE)\
**Post date:** [March 9, 2022, 7:50pm UTC](https://forum.inductiveautomation.com/t/pop-up-list-incorrect-order/47466/9 "2022-03-09T19:50:02Z")

</div>

Just a note about the V8.1 manual in case someone else searches this…

The onPopupTrigger extension function [in the manual](https://docs.inductiveautomation.com/display/DOC81/Extension+Functions) still shows a dictionary.
