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: Ken Thomases <email@hidden>
- Date: Fri, 23 Aug 2013 14:53:43 -0500
On Aug 23, 2013, at 10:22 AM, Jerry Krinock wrote:
> On 2013 Aug 23, at 07:03, Keary Suska <email@hidden> wrote:
>
>> Anyway, perhaps it is a bug in reconciling minSize with minContentSize.
>
> I know, but I really don't want to go there. This is NSWindow, for heaven's sake. From NeXT. The method setMinSize: has probably been called millions of times around the world, by thousands of apps, since the time I started writing this sentence.
>
>> What happens if you use setMinContentSize instead?
>
> OK, I just tried that, and it seems to work properly.
>
> Lesson: Don't use setMinSize:. Use setContentMinSize: instead.
I think it's just that, if you use -setContentMinSize:, you shouldn't also use -setMinSize:. The docs for -setContentMinSize: say:
"This method takes precedence over setMinSize:."
https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/Classes/NSWindow_Class/Reference/Reference.html#//apple_ref/doc/uid/20000013-BCIFFEJE
A similar note is in the docs for -setMinSize:.
> As to science, I just submitted this Document Feedback on -[NSWindow setMinSize:}
>
> -------------------------------------------------
>
> In -setMinSize:, it says "The minimum size constraint is enforced for resizing by the user as well as for the setFrame... methods other than setFrame:display: and setFrame:display:animate:."
>
> This statement is confusing. First of all, I don't see any "other" setFrame… methods. The two methods -setFrame:display: and -setFrame:display:animate: are in fact the *only* setFrame… instance methods in the NSWindow class.
Really? You don't see -setFrameFromString:, -setFrameOrigin:, etc.?
> Second, please clarify what is meant by "enforce". Does this mean that the (present or future?) window size will not change, or that the windowMinSize will not change? I have seen a case where -setMinSize: will fail to "stick". That is, immediately after sending this message, -minSize returns a different value than what was set. This behavior should be explained.
I think the failure of -setMinSize: to do what you expect is explained by you also using -setContentMinSize:.
Regards,
Ken
_______________________________________________
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