PopupMenu.ListIndex performance(?)

At the moment I am rewriting a desktop application for managing student data, which requires a lot of database queries. I wondered, why the application takes so long on startup (1 second, which is much time regarding the current state of the application) and so I started to investigate the problem. At first I suspected that I had some inefficient database queries in my starting methods, but after some further testing I pinned down the problem to this:
I have three PopupMenus in my Window; at application startup their ListIndex is set to a certain index – nothing special here, just “PopupMenu1.ListIndex = 2” etc. But those three simple ListIndex settings take an insanely high amount of almost 700 milliseconds, which is most of the starting time of my application.
Is this a bug or am I doing something wrong here?

Mac or Windows ?

Mac

No idea about your code.
But maybe you have code in change event of those popup menus which runs a to of times?

You could set a flag in app.open on the end like

ready = true

and in change event exit early:

if not ready then return

to make sure you don’t do code a lot of times while you still load popup entries.

I’ll have a look at that when I am back at my computer later. Thanks for the hint!

@Christian: That did the trick, thanks again! Setting the flag reduced the startup time of the application to 200 ms.