Problems with the open-event

I want to use the open event of a popup menu to set its own list index to its highest possible value (last element of the popup list). So I write:


But I get a NilObjectException. I think it’s because the control is not ready for setting the ListIndex at the time when the open event appears.

What can I do? I want the popup menu to set it’s ListIndex itself, not by code from outside the popup menu.


Sure? Me.ListIndex=Me.ListCount-1 works as expected. No NilObjectException appears.
Xojo 2013 R2, Mac