Popupmenu still very slow on BigSur

I only have 150 items and it takes about 5 sec to populate the popupmenu with rowtags

I tried this trick but didnt work in this version (Xojo 2020r2 and BigSur on MacPro)

A 150 items is not a small amount. I would suggest considering an alternative input means. Potentially using some list a listbox and a search field so that people can start entering the name of the item they need/want. Scrolling through a 150 items in a popup menu, may take a long time, and then if you select the wrong one…

2 Likes

What items? And what is your code?

You give far too little info for anyone to provide meaningful help - all we can do is guess.

How to do code this?
Maybe the code is not efficient?

Apart from the slow populating:
To be honest, a popupmenu with 150 items is not very user friendly. As Sam suggested, I guess you need some UI rework here.

popupmenu is still very slow on Windows also, and on webapps. You don’t need to add list items to see it. An empty webpopupmenu takes a long time to render when you show a page. Remove it from the page, the page shows much faster.

I agree with everyone else that 150 items is a lot… As a user, I would curse the developer who forces me to go through such a list to make a choice.

Look at the exemple in the link, and add tag

If you want us to have a look then please show your code or make a downloadable example. “Add tag” isn’t really a good description.

This thread is about macOS which has a documented issue (see Norman’s blog post) with adding many PopupMenu items. You should start your own thread to discuss Windows or WebApps.

Understood and agreed. The idea was not to hijack the thread, but to suggest that the same exists on other platforms, so there is likely an issue that goes beyond just Big Sur or Mac.

I bring it up because I’d like to see a discussion on what’s going on with the web popup menu. I am interested in your experience and what if any workarounds you’ve found.

Louis, on Windows I totally understand you, but on Mac, the popupmenu it a little bit more flexible, per example, you just had to type 2 or 3 first letter/number of what you are looking for, and the PPM brings you where you want. It tooks less time to find something on a big fat list of 150 items then to populate it ! (PS : sorry for my english, i usually speak french !)

1 Like

i disagree, on Mac, when you know how to use a mac, it’s very fast. Especially if you can use both keyboard and mouse in the same time :wink:

It’s in Apple’s guidelines for popup menus that they should be no more than a dozen.

If space isn’t restricted, consider using a single-column table view instead of a pop-up button to present more than 12 choices. Long lists are generally easier to navigate using a table view, which supports scrolling and can’t be inadvertently dismissed. [Source]

You can get the same effect in Listbox by implementing it, even better add a search field. 150+ items is not meant for a popup menu.

You should also consider the fact that multiple people have pointed this out, so there must be some reason people agree on this…

Sam : on windows Popupmenu are retarded… on Mac, you simply have to use arrow key, or type the letter/number of what you looking for. By the way, it’s not a discution of how i want to design my app, it’s about slow to populate !

from a simple loop, it’s 100x slower, imaging from a database :frowning:

Screen Shot 2021-03-01 at 18.45.24

Dim startTime1 As Double 
Dim endTime1 As Double

Dim startTime2 As Double 
Dim endTime2 As Double


startTime1 = Microseconds
PopupMenu1.ListIndex = -1
For i As Integer = 0 To 1000
  PopupMenu1.AddRow Str(i)
  PopupMenu1.RowTagAt(PopupMenu1.LastAddedRowIndex) = i
Next
endTime1 = Microseconds


startTime2 = Microseconds
PopupMenu2.AddRow ""
PopupMenu2.ListIndex = 0
For i As Integer = 0 To 1000
  PopupMenu2.AddRow Str(i)
  PopupMenu2.RowTagAt(PopupMenu2.LastAddedRowIndex) = i
Next
PopupMenu2.RemoveRow 0
endTime2 = Microseconds


Dim total1 As Double = (endtime1 - startTime1) / 1000000
Dim total2 As Double = (endtime2 - startTime2) / 1000000

label1.text = str(total1, "###.00000")
label2.text = str(total2, "###.00000")

I have an autocomplet class for that, but in this case, i need a popupmenu

150 items is way too many for a popupmenu. We are using the standard native control so clearly MacOS does not expect you to have that many. Apple’s UI Guidelines suggest that popup menus should not have more than 12 items.

[quote="(PS : sorry for my english, i usually speak french !)[/quote]

So do I. :wink:

1 Like

To be honest Geoff and apart from the fact that 150 is way too much for a popupmenu, it is not the fault of the macOS API for doing this. I just made a quick test with Xcode adding 1000 items and it took less then 1 second to populate - in fact it was instantaneous. So it is a Xojo issue for sure.

1 Like