Simo Virokannas

Writings and ramblings

NSOpenGLView and NSToolbar issue

For a long time, I’d run to the same problem with projects that included a window containing a full-window NSOpenGLView and a toolbar. In the Interface Builder, the NSToolbar controls open behind the OpenGL view and are unusable.

There is a simple, although kludgy, way around this:
Set the NSOpenGLView hidden in the View settings of the control. Then, add a line to your window controller’s awakeFromNib method:
-(void)awakeFromNib {
[[self glview] setHidden:NO]; // glview is the NSOpenGLView control
}

Result: You can still control the view inside the window normally in Interface Builder, but NSToolbar opens on top, the OpenGLView still opens up normally, and everybody is happy.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.