• 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: Updating the main menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating the main menu


  • Subject: Re: Updating the main menu
  • From: j o a r <email@hidden>
  • Date: Mon, 10 Nov 2003 20:43:58 +0100

In general I don't think that it is recommended, or standard, behaviour
to add/remove parts of the UI like this. If a control is not
applicable, you should just disable it, not remove it.

j o a r

On 2003-11-10, at 20.02, Eric Wang wrote:

> I need to add and remove items from the main menu of my application
> depending on whether or not a certain window is key. Calling
> -insertItem:atIndex: and -removeItem: on the main menu works for the
> most
> part, however there seems to be a delay before the menu bar actually
> updates.
>
> If I switch windows quickly enough, the menu bar never shows the menu
> items
> I've added. This also causes a problem when switching to my
> application from
> another application. The menu bar is updated twice - once to reflect
> the
> static menu items in my MainMenu.nib, and another time to reflect the
> items
> I've programmatically added.
>
> Is there any way to force the main menu to update immediately? I've
> tried
> just about every combination of
>
> -[NSMenu update]
> -[NSMenu sizeToFit]
> -[NSMenu setMenuChangedMessagesEnabled:]
> -[NSApplication setWindowsNeedUpdate:]
> -[NSApplication updateWindows]
> -[NSApplication setMainMenu:]
>
> I can think of, but nothing seems to work. Calling [NSMenu
> setMenuBarVisible: NO] and then [NSMenu setMenuBarVisible: YES] works,
> but
> there is a side effect causing the display to flicker.
>
> Any ideas or pointers in the right direction appreciated.

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Updating the main menu
      • From: Eric Wang <email@hidden>
References: 
 >Updating the main menu (From: Eric Wang <email@hidden>)

  • Prev by Date: Re: DataSource class of NSTableView - weird
  • Next by Date: cocoa help
  • Previous by thread: Updating the main menu
  • Next by thread: Re: Updating the main menu
  • Index(es):
    • Date
    • Thread