Pop-up list incorrect order

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

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.

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()?

Two separate lists. One of names, one of corresponding functions. As shown in the manual.

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

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

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)

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

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

The onPopupTrigger extension function in the manual still shows a dictionary.