Popup Menu Icon Alignment Issue.

I have a situation that I believe has been found in prior Xojo versions, but I can’t find a feedback case that matches my issue 100%.If anyone could you let me know if I have something new here and if so i can submit a feedback. (Thanks in advance!)
I checked <https://xojo.com/issue/2121> and this was the closest thing I could find…

I am creating a set of Dynamic MenuItems and using a MenuItem.Popup to call it to the screen. My issue is that the text is always out of alignment when and only when I add icons.

Here is a picture of my issue using the code below (Take Notice of the text alignment on the popup menu):

    Dim Share_MenuItem1 as new MenuItem
    Dim MailMenuLogo_retina as HIDPIPicture = HIDPIPicture.imageNamed( "mail_menuicon" )
    Share_MenuItem1.Text = "Mail"
    Share_MenuItem1.Tag = 0
    Share_MenuItem1.Icon  = MailMenuLogo_retina.pictureValue
    
    Dim Share_MenuItem2 as new MenuItem
    Dim PrintMenuLogo_retina as HIDPIPicture = HIDPIPicture.imageNamed( "print_menuicon" )
    Share_MenuItem2.Text = "Print"
    Share_MenuItem2.Tag = 1
    Share_MenuItem2.Icon  = PrintMenuLogo_retina.pictureValue
    
    dim ShareMenuPopUp as New MenuItem
    ShareMenuPopUp.append Share_MenuItem1
    ShareMenuPopUp.append Share_MenuItem2
    
    Dim m as new MenuItem
    m = ShareMenuPopUp.PopUp
    
    if m <> nil then
      if m.Tag = 0 Then
        // Mail
        
      Elseif m.Tag = 1 Then
        // Print
        
      end if
      
    end if

OS: Mac 10.10.1
Xojo: 2014R2.1

Are the icons the same size?

I can’t say they are 100%. I can retry using the same images for both and then using the same wording to see what happens.

Icons should have the same width at least. Even if it’s empty space.

Greg the original images I had been trying were NOT the same size. I used the same sized image on both menu entries to try and now the wording is aligned properly. I had been assuming the image size was in a hidden column or something. I will adjust the icons to be identical in size.

Thank you.
Mike

[quote=157040:@Mike Cotrone] Dim MailMenuLogo_retina as HIDPIPicture = HIDPIPicture.imageNamed( “mail_menuicon” )
Share_MenuItem1.Text = “Mail”
Share_MenuItem1.Tag = 0
Share_MenuItem1.Icon = MailMenuLogo_retina.pictureValue[/quote]
Hi Mike,
You may want to change the above code to be like below (by using the pictureValue property of the HIDPIPicture, you’re actually rendering a static image and thus losing the retina effect).

Dim MailMenuLogo_retina as HIDPIPicture = HIDPIPicture.imageNamed( "mail_menuicon" ) Share_MenuItem1.Text = "Mail" Share_MenuItem1.Tag = 0 Share_MenuItem1.setIcon MailMenuLogo_retina
This will retina the retina ability.

You can also reduce your code by using the menuitem constructor, to set the menu item text and tag.

Dim Share_MenuItem1 as new MenuItem( "Mail", 0 )

If you have the Retina Kit 2, you can actually grab the icon from Apple’s mail application.

Dim af as folderItem = specialFolder.applications.child( "Mail.app" ) if af <> nil and af.exists then // --- Make sure that mail exists, you never know! Dim p as RKPicture = retinaKit.iconForFile( af ) if p <> nil then // --- make sure we have an image. p.setSize 16, 16 // --- Resize the image so it's suitable for a menu item. Share_MenuItem1.setIcon p end if end if

Thanks Sam!!!