DesktopMenuItem.Popup fails erratically on internal laptop screen

OK, this is super frustrating, and I hope someone else has had this experience and figured it out. To save me a bunch of typing, all the controls are the Desktop* versions. This is on Mac Sonoma 14.4 on an Intel MacBook Pro.

I have a global floating window with a Listbox containing several rows. The Listbox responds to contextual clicks on these rows by constructing and displaying a popup menu via DesktopMenuItem.Popup().

This works fine on my external monitor, which is a standard resolution - the popup always appears. But when I move the window to the laptop’s built-in screen (which is incidentally Retina), the popup is only displayed erratically.

Here is the code from Listbox.CellPressed, paraphrased:

select case column
case kNameColumn
  if IsContextualClick then
    SelectedRowIndex=row
    
    'Show the menu
      dim theMenu as DesktopMenuItem
      
      theMenu=new DesktopMenuItem
            
      PopulatePopupMenu(themenu)
      
      dim selectedMenuItem as DesktopMenuItem
      
      selectedMenuItem=theMenu.PopUp
      
      if selectedMenuItem<>nil then
          ...
      end
    end
    
    return true
  end
end

The menu is populated with a list of 40-50 text items, each of which has a small graphical icon associated with the row; two or three separators. No submenus.

When debugging, the line containing Popup is executed but when the window is on the internal screen, no popup menu is displayed about 70% of the time and selectedMenuItem is nil. The popup menu is displayed 100% of the time on the external screen and selectedMenuItem always contains a correct value.

I see nothing in this code that could possibly account for the issue - there is nothing here that is sensitive to screen resolution, window location, pointer location, etc.

Thoughts?

Make a sample with repro instructions, upload it in an issue report.

There are some x,y mess in some edge cases in 2024r1, maybe you found something alike.

Is there a reason that you’re not using the built-in contextual menu events?

Make a sample with repro instructions, upload it in an issue report.

I tried a quick test project - I couldn’t get it to reproduce. Heck, 30% of the time it doesn’t reproduce in my actual project. It’s extremely unpredictable and I was crossing my fingers hoping that someone would have seen this before.

There are some x,y mess in some edge cases in 2024r1, maybe you found something alike.

Possible, but it is still firing the CellPressed event and the row appears to be correct. This suggests that this isn’t a coordinate edge case.

Because I’ve been using this language for longer than those events have been available? :slight_smile: Thanks. I’ll see if it suits my needs.