• 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: taking control of the Window menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: taking control of the Window menu


  • Subject: Re: taking control of the Window menu
  • From: PGM <email@hidden>
  • Date: Sun, 15 Apr 2007 23:34:45 -0400


I'm writing a document based app where each document may have an essentially infinite number of detailed views associated with it. Right now, as these windows are opened, they're just tacked on to the window list in order. I think it would be a better UI to group them by document.


A while ago, I ran into more or less the same problem, as my program has four different types of documents and I wanted my Window menu to be sorted by type rather than in alphabetical order. I started out by trying to make my own Window menu, but that approach proved to have some major difficulties, among others as there is no Cocoa way to add the little bullets in front of the names of windows with unsaved changes and diamonds for minimised windows.


The approach I now took is much simpler and works very well. I use the - (void)menuNeedsUpdate:(NSMenu *)menu delegate method, put all "window" items (so not Minimise and Zoom etc.) from the menu into an array (so they are retained), remove them from the menu, and then put them back in my preferred order. You can use setIndentationLevel:1 on the menuItems to make them indented like in the Xcode Window menu.

The drawback of this method is that it will be called every time the menu is clicked, and that it may result in a noticeable delay in the opening of the menu if you indeed have an infinite number of windows.

Good luck, Patrick


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >taking control of the Window menu (From: "John R. Timmer" <email@hidden>)

  • Prev by Date: Re: CGEventKeyboardGetUnicodeString + modifier key
  • Next by Date: Re: CGEventKeyboardGetUnicodeString + modifier key
  • Previous by thread: Re: taking control of the Window menu
  • Next by thread: display NSXMLDocument with NSOutlineView and NSTreeController
  • Index(es):
    • Date
    • Thread