Re: NSWindow setMinSize: jumps up to current size instead
Re: NSWindow setMinSize: jumps up to current size instead
- Subject: Re: NSWindow setMinSize: jumps up to current size instead
- From: Keary Suska <email@hidden>
- Date: Fri, 23 Aug 2013 08:03:47 -0600
On Aug 23, 2013, at 7:24 AM, Jerry Krinock wrote:
> This should be easy. What am I doing wrong here?
>
> • Window height is 692, content min height is 363 and min height is 431.
> • I set the min height to 646.
> • Read it back, using -minSize.
>
> Expected result: Because I tried to *increase* the *minimum* height, and to a value less than the current height, there should be no conflicts. It should obey me.
>
> Actual result: Instead of increasing from 431 to 646, min height increased more, to 692, the current height of the window. Why?
>
> Coincidentally, I'm setting the min width to the current width. That works as expected.
>
> Thanks to anyone who can make my day.
Just to be sure, is autolayout enabled? Anyway, perhaps it is a bug in reconciling minSize with minContentSize. What happens if you use setMinContentSize instead?
> * CODE *
>
> NSLog(@" styleMask = 0x%lx resizable = %hhd",
> (long)[window styleMask],
> (BOOL)(([window styleMask] | NSResizableWindowMask) > 0)) ;
>
> NSLog(@"1 current = %@", NSStringFromSize([window frame].size)) ;
> NSLog(@"1 contentMin = %@", NSStringFromSize([window contentMinSize])) ;
> NSLog(@"1 min = %@", NSStringFromSize([window minSize])) ;
>
> NSLog(@"Setting min to %@", NSStringFromSize(windowMinSize)) ;
> [window setMinSize:windowMinSize] ;
>
> NSLog(@"2 current = %@", NSStringFromSize([window frame].size)) ;
> NSLog(@"2 contentMin = %@", NSStringFromSize([window contentMinSize])) ;
> NSLog(@"2 min = %@", NSStringFromSize([window minSize])) ;
>
>
> * CONSOLE OUTPUT *
>
> styleMask = 0xf resizable = 1
> 1 current = {580, 692}
> 1 contentMin = {520, 363}
> 1 min = {520, 431}
> Setting min to {580, 646}
> 2 current = {580, 692}
> 2 contentMin = {580, 624}
> 2 min = {580, 692}
>
> The reason for the rather large differences, 68, between the min height and content min height, is because this window has a toolbar in addition to a title bar.
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden