• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Menu Bar App: [NSStatusItem popUpStatusItem] : Menu shows popupmenu too high
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Menu Bar App: [NSStatusItem popUpStatusItem] : Menu shows popupmenu too high


  • Subject: Menu Bar App: [NSStatusItem popUpStatusItem] : Menu shows popupmenu too high
  • From: Dan Stenning <email@hidden>
  • Date: Fri, 12 Jun 2015 22:22:33 +0100
  • Importance: Normal

Hi,




I have this cocoa code in order to show a menu when a “menu app” or menu-extras icon is clicked on
on the menu bar.
Only trouble is it pops up on top of my menu-app icon, at the very top  instead of right _below_ the menu bar. What am i doing wrong ?
here is the code in question:


  // NOTE:  pimpl->statusItem is a  NSStatusItem*
void SystemTrayIconComponent::createMenu()
{

    NSMenuItem *tItem = nil;

    pimpl->theMenu = [[NSMenu alloc] initWithTitle:@""];
    [pimpl->theMenu setAutoenablesItems:NO];


    [pimpl->theMenu addItemWithTitle:@"One" action:nil keyEquivalent:@""];
    [pimpl->theMenu addItemWithTitle:@"Two" action:nil keyEquivalent:@""];
    [pimpl->theMenu addItemWithTitle:@"Three" action:nil keyEquivalent:@""];

    [pimpl->theMenu addItem:[NSMenuItem separatorItem]];

    tItem = [pimpl->theMenu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"];
    [tItem setKeyEquivalentModifierMask:NSCommandKeyMask];

    NSStatusBar *statusBar = [NSStatusBar systemStatusBar];
    pimpl->statusItem = [statusBar statusItemWithLength:NSVariableStatusItemLength];
   // [pimpl->statusItem retain];

    [pimpl->statusItem setToolTip:@"This is our tool tip text"];
    [pimpl->statusItem setHighlightMode:YES];
    [pimpl->getView() setMenu:pimpl->theMenu];

}




void SystemTrayIconComponent::showDropdownMenu(Point<int> mousePos)



    [pimpl->statusItem popUpStatusItemMenu: pimpl->theMenu ];


}

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Menu Bar App: [NSStatusItem popUpStatusItem] : Menu shows popupmenu too high
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: for case and if case (Swift 2)
  • Next by Date: Re: Going back to non-ARC
  • Previous by thread: Re: rangeOfString with .RegularExpressionSearch not matching begin and end of line (Swift)
  • Next by thread: Re: Menu Bar App: [NSStatusItem popUpStatusItem] : Menu shows popupmenu too high
  • Index(es):
    • Date
    • Thread