Popupmenu still very slow on BigSur

I’m not seeing any slowdowns. In one window I have a popup menu with already too many choices (20-30). I first added the values 10 times and then 100 times. No slowdown. Xojo 2020r2.1 on High Sierra. Are newer versions of macOS slower?

I see the slowdown in Mojave 10.14.6.

Running Instruments, it’s clear what’s happening: After every item added, the PopupMenu is triggering the itemChanged event and (possibly) doing a visual refresh as well.

Here’s the stack trace (Note: this is with N = 2000 items in the list, on 10.14.6 on a i9 cpu, running in the debugger):

Yup. If you add a row to the popup menu first, set the list index, then add the other 149 rows you’ll see a significant speed up.

From the code, it looks like this is purely an Apple bug, as it’s not involving any Xojo framework calls.

However, since it is invoking the NSMenuDidAddItemNotification event, I wonder if Xojo could do something to block that event if it’s in happening inside the CocoaPopupMenu::AddItem() method?

Except it’s for choosing a font! :wink:

Edit: Forgot the :wink:

2 Likes

Doesn’t happen when using Swift (Xcode). it’s definitely a Xojo issue.

Apple apps (those I’m aware of) show a listbox in its font window to select a font. IIRC, there’s no longer a Fonts menu (or submenu) and no PoppupMenu either.
Have you actually read choosing a font is encouraged in the HIG?

I was going to bring this up, but I didn’t find a way to use the font window from within Xojo.

Screen Shot 2021-03-03 at 10.05.21

Is it available through MBS somehow @Christian_Schmitz ?

Interesting. I wonder what the difference is? It seems strange that setting

PopupMenu2.AddRow ""
PopupMenu2.ListIndex = 0

before adding rows will prevent the slowdown, so maybe Swift is doing something different internally?

Pages – for example – still has a popup to select a font in the inspector.

3 Likes