In your NSView:

- (void)viewDidMoveToWindow
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowResized:) name:NSWindowDidResizeNotification object:[self window]];
}

- (void)dealloc
{
        [[NSNotificationCenter defaultCenter] removeObserver:self];
        [super dealloc];
}

- (void)windowResized:(NSNotification *)notification;
{
        NSSize size = [[self window] frame].size;

NSLog(@"window width = %f, window height = %f", size.width, size.height);
}

Hope this helps!
        - Greg

On May 25, 2008, at 5:49 PM, Graham Reitz wrote:
I don't think I am presenting my question well enough. Let me try again.

I have a custom NSView object with a NSOpenGLContext in it. When the window is resized how do you capture the window height and width (not the derived NSView object's height/width, it doesn't change) so I can adjust the view port appropriately.

Assume that I need a custom NSView. It seems this behavior comes for free when inheriting from NSOpenGLView.

Posters often suggest that I go to the online apple docs and figure it out. I am looking online after I make all these posts. The majority of the time I get a response sooner than I figure it out. I am on the steep slope of the learning curve and will be off in short order.

Thanks again for all the help.

-graham


On May 25, 2008, at 6:14 PM, Scott Andrew wrote:

For a window:

If you are registered as the delegate you can handle the windowWillResize:toSize: call to get called just before the reisize. Or, If you want the message after the resize, you can handle the windowDidResize: call.

For a view:

You can register to receive the NSViewFrameDidChangeNotification notification. This is called after the frame of the view has been changed. I don't know of a message to track it real time.

Scott

On May 25, 2008, at 4:00 PM, Graham Reitz wrote:

How do you detect a resize event?

I can see that lockFocus and drawRect are getting called.

Is there a method to help determine if the user is resizing the window?

thanks,
graham
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/scottandrew%40adelphia.net

This email sent to [EMAIL PROTECTED]


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/greg%40omnigroup.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to