FROM : Peter Ammon
DATE : Fri Apr 18 23:23:22 2008
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.
DATE : Fri Apr 18 23:23:22 2008
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.
| Related mails | Author | Date |
|---|---|---|
| Justin Williams | Apr 18, 20:26 | |
| Justin Williams | Apr 18, 22:06 | |
| Peter Ammon | Apr 18, 23:23 |






Cocoa mail archive

