[NSWindow orderOut] from NSOpenGLView?

Oldtimer
Posts: 834
Joined: 2002.09
Post: #1
I have a subclassed NSOpenGLView residing in a window - the standard way, all set up in IB. Now, I'd like this window to go away from time to time, so I call [[self window] orderOut:self], and nothing happens. [[self window]center] works just fine, and NSLogging [self window] looks all right. Is there something obvious I'm overlooking, or have I just messed up somewhere else?
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #2
I may be wrong, but have you made the window to be the delegate of File's Owner in IB? It may not be required though, but it never hurts to try Smile

"When you dream, there are no rules..."
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #3
Wiring it as a delegate of anything won't help since it isn't a delegate method. [[self window] orderOut:self] *should* work as is if [[self window]center] is right next to it and works. Maybe Xcode is goofing up? Clean project? Turn off zero-link for a build? I have no clue, that's just bizarre that it won't work right.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #4
OK, thanks for the help anyway. I'll try cutting back all of my functionality until I find the culprit.
Quote this message in a reply
Member
Posts: 129
Joined: 2005.02
Post: #5
In what class are you calling the [ self window ]? A NSWindowController? Or the view? I'm confused.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #6
From a subclass of an NSOpenGLView... do I have to do it from a window controller?
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #7
No. It should work perfectly from anywhere - as long as you can get access to "window" of course.

One idea that just came to mind is that maybe orderOut is implemented somewhere else besides NSWindow, as it should be. You could try typing orderOut somewhere in your NSOpenGLView subclass, then cmd-double-click on it and it should come up highlighted in NSWindow.h. If it doesn't come up highlighted in NSWindow.h or if a pop-up comes up instead to allow you to choose more than one orderOut, then you found a problem.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #8
Are you attempting to call orderOut in your awakeFromNib method? That won't work since the window isn't showing yet at that point, and the call is ignored.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #9
Quote:That won't work since the window isn't showing yet at that point, and the call is ignored.
Ah, that seems to be it. Let me rephrase that question then: how can I make a window not show up when the program starts? Just send it off to a really large coordinate on the X axis?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #10
uncheck the "visible at launch" box in IB?
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #11
That's surprisingly embarrassing. Thanks.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #12
I do that crap all the time. Better you than me for a change! Rasp
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Nothing showing up in NSOpenGLView [newb] binaryinsomnia 6 6,571 Nov 29, 2011 07:04 PM
Last Post: binaryinsomnia
  Cocoa controls on top of NSOpenGLView wadesworld 5 5,977 Apr 6, 2009 01:38 AM
Last Post: arekkusu
  Antialiasing and NSOpenGLView attributes Jar445 2 6,593 Jan 20, 2009 10:42 AM
Last Post: maximile
  Adding NSOpenGLView class in Xcode/Interface Builder 3.0 Graphic Ace 2 3,732 Dec 5, 2007 02:15 PM
Last Post: Blacktiger
  Double-Buffering with NSOpenGLView DesertPenguin 3 5,766 Aug 1, 2006 07:17 AM
Last Post: DesertPenguin