Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7608603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:57:25+00:00 2026-05-31T00:57:25+00:00

I have a statusitem in the system menu bar that makes a popover appear

  • 0

I have a statusitem in the system menu bar that makes a popover appear when it is clicked. I would like to make the popover automatically appear when the application is first launched. I tried to add the [self clickStatusBar:self] to the awakeFromNib method but it doesn’t work. Anyone know how to accomplish this?

Here are my current methods:

- (void)awakeFromNib {
    statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
    [statusItem setTitle:@"Locating..."];
    [statusItem setTarget:self];
    [statusItem setAction:@selector(clickStatusBar:)];
    [statusItem setHighlightMode:YES];
}

- (void)clickStatusBar:(id)sender {
    [[self popover] showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge];
}

I tried adding applicationDidFinishLaunching: as

- (void)applicationDidFinishLaunching:(NSNotification *)notification {
    [self clickStatusBar:self];
}

but I get an error of
-[AppDelegate bounds]: unrecognized selector sent to instance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:57:27+00:00Added an answer on May 31, 2026 at 12:57 am

    In awakeFromNib: the application is not fully launched yet, only this NIB file has been unmarshalled. At this point this method gives you a hook to complete (object-local) initialization. The application is (quite likely) not ready to process events or perform actions.

    You should trigger that action from applicationDidFinishLaunching: method, an optional method in the application delegate, and pass in the status item like a click would do (because you query it for bounds).

    Update. This is trickier than I had thought. Turns out, the NSStatusItem doesn’t have a view associated at that point when the delegate gets called. I’d venture to say that is a bug with NSStatusItem. When statusItem.view is called in applicationDidFinishLaunching:, the popover method receives nil and complains.

    The only (partial, see below) workaround that I have found is to set a button as view manually in awakeFromNib: like so:

    - (void)awakeFromNib
    {
      self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
    
      self.statusItemButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 83, 22)];
      self.statusItemButton.title = @"Locating...";
      self.statusItemButton.bordered = NO;
      [self.statusItemButton setAction:@selector(clickStatusBar:)];
    
      self.statusItem.view = self.statusItemButton;
    }
    

    That way you’d have a view around when the application is done launching. But beware, it doesn’t look like the default one.

    PS. And curiously, and does not even work every time. I have to drop the ball here. Sorry. Maybe save the location in the defaults when somone clicks. I think I saw such an inconsistency in Cloud.app and with a popover next to a status item, and maybe now we know why 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this application that shows an item in the system's status bar, and
I'm trying to make a simple menu bar only application on xcode 4. Everything
I have already created a status item for the menu bar but I would
Have just started converting an existing job tracking system into an ASP.NET MVC application.
Ok I have a status menu application with a Hide menu item in it.
I have a text field inside a status item and would like for it
I'm writing a mac app that sits in the menu bar and presents the
I have an application that, upon activation, is 'backgrounded' and has an NSStatusItem icon
I'd like to build a cocoa app and would like to have it opened
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.