On Jul 22, 2012, at 02:00 , Motti Shneor wrote:
> - (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize {
> NSSize min = [sender minSize];
> NSSize max = [sender maxSize];
> if (frameSize.width > max.width ||
> frameSize.height > max.height ||
> frameSize.width < min.width ||
> frameSize.height < min.height)
> return sender.frame.size;
> else
> return frameSize;
> }
AFAICT this implementation doesn't do anything. As was mentioned in another
thread yesterday or the day before, and in the class documentation, the min/max
constraints have already been applied when this method is called, so re-testing
the constraints is pointless.
Of course, that doesn't explain how the window gets smaller than it should be.
(Also, it seems wrong to return sender.frame.size, since that would prevent the
window from actually getting pinned to the limits enforced by this method, if
there were any.)
(Also, if you're using min/maxContentSize as shown in your other code sample,
you should check that everywhere rather than min/maxSize in some places. The
documentation says the min/maxContentSize constraint "overrides" min/maxSize,
not "sets" it.)
> 2012-07-22 11:44:01.178 AT&T Connect[19369:407] Window min content
> size:{1001, 579} current size {1001, 517}
>
> As you can see, my window is forced to get to 517 pixels height, despite my
> imposed minSize of 579 pixels, and in spite of the implementation you
> suggested.
It would be slightly more reassuring to log all of the window's size, with min
and max, as well as the content size, with min and max, as they are this moment
in execution.
Incidentally, NSWindow's 'setFrame:display:' is documented to ignore the
min/max sizes. Is there any place you're calling this yourself?
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]