• 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: NSPanel with just a close button & title on title bar?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPanel with just a close button & title on title bar?


  • Subject: Re: NSPanel with just a close button & title on title bar?
  • From: Ryan Stevens <email@hidden>
  • Date: Fri, 19 Nov 2004 08:38:31 -0800

On Nov 19, 2004, at 3:05 AM, Ken Tabb wrote:

On 19 Nov 2004, at 7:40 am, Peter Maurer wrote:

So this should remove the zoom button from a window:

[[window standardWindowButton:NSWindowZoomButton] removeFromSuperview];

I did this once, and as far as I can remember, my app crashed unless I retained those buttons before removing them from their superview. Thus, I came to the conclusion that the NSWindow still wanted to "talk" to its standard buttons from time to time, and that it was very unhappy if someone had released them (via removeFromSuperview).


Can anyone confirm?

(Unfortunately, I don't have access to that piece of code right now, so there's a certain possibility that my code had other flaws which caused the crash.)

You're both right! Andreas' method indeed knocks the zoom / miniaturise (/ close if you wanted it off) buttons off the title bar, and as Peter says you need to retain the buttons else the app crashes when the window is drawn to screen. Bearing in mind it's a global panel for the app, this I can live with (releasing in app delegate on quit).


More annoyingly for me is that although the method removes the 2 buttons that I don't want in the title bar, the title string is still drawn semi off the window, i.e. it's position is no different to when there are all 3 buttons, there's just a centimetre gap between the close button and the title.

8^(

Oh well it was worth a try! Thanks for all the help anyway!


You can draw the title yourself...

{
id superview = [[window standardWindowButton:NSWindowZoomButton] superview];
[superview addSubview:aTextField];
}


Not sure if you'll need to pass events up to the superview or not but with something like this you could even draw an attributed title if you wanted.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSPanel with just a close button & title on title bar?
      • From: "M. Uli Kusterer" <email@hidden>
References: 
 >NSPanel with just a close button & title on title bar? (From: Ken Tabb <email@hidden>)
 >Re: NSPanel with just a close button & title on title bar? (From: Ricky Sharp <email@hidden>)
 >Re: NSPanel with just a close button & title on title bar? (From: Andreas Mayer <email@hidden>)
 >Re: NSPanel with just a close button & title on title bar? (From: Peter Maurer <email@hidden>)
 >Re: NSPanel with just a close button & title on title bar? (From: Ken Tabb <email@hidden>)

  • Prev by Date: Re: Cocoa-dev Digest, Vol 1, Issue 303
  • Next by Date: [SOLVED] NSControls in drawers attached to modal panels under 10.2.8
  • Previous by thread: Re: NSPanel with just a close button & title on title bar?
  • Next by thread: Re: NSPanel with just a close button & title on title bar?
  • Index(es):
    • Date
    • Thread