Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3656

DesktopMenuItem.Popup fails erratically on internal laptop screen

$
0
0

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?

5 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 3656

Trending Articles