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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to