Resizing an NSOpenGLView
Resizing an NSOpenGLView
- Subject: Resizing an NSOpenGLView
- From: Ivan Milles <email@hidden>
- Date: Wed, 5 Mar 2003 16:48:50 +0100
Hi all,
This is a problem that has haunted me for 30+ hours of straight coding,
and I'm going truly nuts here. It seems to be a quite simple problem,
but it just doesn't obey me. :D
What I want is to put a subclassed NSOpenGLView into an NSScrollView.
No problems, that far. Now, I want to resize that OpenGLView within the
ScrollView, so that I can scroll it around if it grows larger than the
ClipView.
I use setFrameSize on the OpenGLView to set the new size, and it works
half-way. Originally, I just set the frame size, but that proved to
show either no change, or garbled drawing until I minimized the window
and restored it. Then, I tried to setNeedsDisplay to the superview's
superview.
(CustomView->NSClipView->NSScrollView)
This makes the behaviour a little more stable - now I just need to
rescroll the window to get the correct drawing. (However, if the view
is smaller than the scroll bars, this is of course not possible.)
I've narrowed the problem down into a minimal app that shows the
behaviour. In IB, the OpenGLView is sized 100, 100, and this method is
wired to an NSButton - it just wants to set the OpenGLViews size to
300, 300 when the button is pressed.
- (IBAction)setNewSize:(id)sender
{
[self setFrameSize:NSMakeSize(300, 300)];
[[[self superview]superview]setNeedsDisplay:YES];
}
What the heck do I need to do to resize this GLView? I figure that
having to minimize/rescroll the view hints at some updating needs to be
done, but where and what?
I'm desperate, so any help is appreciated with capital A.
Thanks,
Ivan
_______________________________________________
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.