• 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
Re: NSBundle loadNib creates extra NSMenuItem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBundle loadNib creates extra NSMenuItem


  • Subject: Re: NSBundle loadNib creates extra NSMenuItem
  • From: Peter Ammon <email@hidden>
  • Date: Fri, 18 Apr 2008 14:23:22 -0700

These items in the upper right are called status items, to distinguish them from menu items that are in menus.

A likely reason for this is that you create the status item in awakeFromNib, and awakeFromNib is being executed twice - once when the main nib is loaded, and once again when your Registration nib is loaded.

You could fix this by moving the code to another method, such as applicationDidFinishLaunching:, or checking if your status item exists before creating it in awakeFromNib.

-Peter

On Apr 18, 2008, at 11:26 AM, Justin Williams wrote:

Hi,

I have an NSMenuItem in my application that toggles the visibility of
my application's main window.  If the user hasn't entered a license
code for the application, I call a method in my main controller that
shows a custom sheet that asks them to register.

- (void) showTrialWindow {
	if (!oRegistrationPanel)
		[NSBundle loadNibNamed:@"Registration" owner:self];

// Other stuff
}

When I call this showTrialWindow, it will temporarily create a
secondary NSMenuItem in the user's menu bar.   Is there a better way I
could load the nib so that it wouldn't create the secondary menu item?

Thanks for the assistance.


_______________________________________________

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


References: 
 >NSBundle loadNib creates extra NSMenuItem (From: "Justin Williams" <email@hidden>)

  • Prev by Date: Re: setTextContainerInset with different values for left and right
  • Next by Date: [SOLVED] Simulating menu bar blink in Cocoa
  • Previous by thread: Re: NSBundle loadNib creates extra NSMenuItem
  • Next by thread: Bitmap data from CGImageRef
  • Index(es):
    • Date
    • Thread