Re: How to reposition subviews without Auto Layout

2020-10-17 Thread Richard Charles via Cocoa-dev
So why not just do this.

[myView translatesAutoresizingMaskIntoConstraints:NO];
[myView setAutoresizingMask:myMask];

--Richard Charles


> On Oct 17, 2020, at 2:47 PM, Andreas Falkenhahn  
> wrote:
> 
> No, they are inserted programmatically.
> 
>> On 17.10.2020 at 18:41 Richard Charles wrote:
>> 
>> Just curious if these three subviews are in a nib or xib file or
>> are they inserted into the content view programmatically?
>> 
>> --Richard Charles
___

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

This email sent to arch...@mail-archive.com


Re: How to reposition subviews without Auto Layout

2020-10-17 Thread Andreas Falkenhahn via Cocoa-dev
Yeah, that's fine with me. I don't care what's going on under the hood as long 
as I'm not bothered with the Autolayout API ;)

On 17.10.2020 at 18:52 Rob Petrovec wrote:

> As was pointed out by an earlier reply, even if you use -layout or
> setAutoresizingMask you are still using auto layout. The frame
> changes get converted to auto layout constraints under the hood.  If
> you said “without using Autolayout API” that would be more correct.

> —Rob


>> On Oct 17, 2020, at 9:46 AM, Andreas Falkenhahn via Cocoa-dev 
>>  wrote:

>> Thanks, out of curiosity I've tried to override the "layout" method and see 
>> if it works and it indeed does. So it looks like simply overriding the 
>> "layout" method and doing the positioning and sizing there is also possible 
>> without using any Auto Layout features whatsoever...

>> On 17.10.2020 at 16:30 Richard Charles wrote:

>>> You could call this method on your three views.

>>> -[NSViewView setAutoresizingMask:]

>>> --Richard Charles


 On Oct 17, 2020, at 6:57 AM, Andreas Falkenhahn via Cocoa-dev 
  wrote:

 Hi,

 I have an NSView that I set as the content view of my NSWindow. The NSView 
 has three subviews. Where should I reposition and resize those three 
 subviews when the NSWindow size changes? 

 I see that NSView has a "layout" method that can be overridden but AFAIU 
 this is only to be used for Auto Layout. I don't want to use Auto Layout 
 because my whole layout is very simplistic and just involves those three 
 subviews which I can easily position and size manually. I just need to 
 know where to put the code that sets their new position and size... anyone?

 -- 
 Best regards,
 Andreas Falkenhahn




>> -- 
>> Best regards,
>> Andreas Falkenhahnmailto:andr...@falkenhahn.com

>> ___

>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com

>> This email sent to petr...@mac.com




-- 
Best regards,
 Andreas Falkenhahnmailto:andr...@falkenhahn.com

___

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

This email sent to arch...@mail-archive.com


Re: How to reposition subviews without Auto Layout

2020-10-17 Thread Andreas Falkenhahn via Cocoa-dev
No, they are inserted programmatically.

On 17.10.2020 at 18:41 Richard Charles wrote:

> Just curious if these three subviews are in a nib or xib file or
> are they inserted into the content view programmatically?

> --Richard Charles


>> On Oct 17, 2020, at 9:46 AM, Andreas Falkenhahn  
>> wrote:

>> Thanks, out of curiosity I've tried to override the "layout" method and see 
>> if it works and it indeed does. So it looks like simply overriding the 
>> "layout" method and doing the positioning and sizing there is also possible 
>> without using any Auto Layout features whatsoever...

>> On 17.10.2020 at 16:30 Richard Charles wrote:

>>> You could call this method on your three views.

>>> -[NSViewView setAutoresizingMask:]

>>> --Richard Charles


 On Oct 17, 2020, at 6:57 AM, Andreas Falkenhahn via Cocoa-dev 
  wrote:

 Hi,

 I have an NSView that I set as the content view of my NSWindow. The NSView 
 has three subviews. Where should I reposition and resize those three 
 subviews when the NSWindow size changes? 

 I see that NSView has a "layout" method that can be overridden but AFAIU 
 this is only to be used for Auto Layout. I don't want to use Auto Layout 
 because my whole layout is very simplistic and just involves those three 
 subviews which I can easily position and size manually. I just need to 
 know where to put the code that sets their new position and size... anyone?

 -- 
 Best regards,
 Andreas Falkenhahn




-- 
Best regards,
 Andreas Falkenhahnmailto:andr...@falkenhahn.com

___

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

This email sent to arch...@mail-archive.com


Re: How to reposition subviews without Auto Layout

2020-10-17 Thread Jean-Daniel via Cocoa-dev
If you want to be pedantic, I would rather say "without using Auto Layout 
constraints ».
Even the -layout method is part of the AutoLayout API.


> Le 17 oct. 2020 à 18:52, Rob Petrovec via Cocoa-dev 
>  a écrit :
> 
> As was pointed out by an earlier reply, even if you use -layout or 
> setAutoresizingMask you are still using auto layout. The frame changes get 
> converted to auto layout constraints under the hood.  If you said “without 
> using Autolayout API” that would be more correct.
> 
> —Rob
> 
> 
>> On Oct 17, 2020, at 9:46 AM, Andreas Falkenhahn via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> Thanks, out of curiosity I've tried to override the "layout" method and see 
>> if it works and it indeed does. So it looks like simply overriding the 
>> "layout" method and doing the positioning and sizing there is also possible 
>> without using any Auto Layout features whatsoever...
>> 
>> On 17.10.2020 at 16:30 Richard Charles wrote:
>> 
>>> You could call this method on your three views.
>> 
>>> -[NSViewView setAutoresizingMask:]
>> 
>>> --Richard Charles
>> 
>> 
 On Oct 17, 2020, at 6:57 AM, Andreas Falkenhahn via Cocoa-dev 
  wrote:
>> 
 Hi,
>> 
 I have an NSView that I set as the content view of my NSWindow. The NSView 
 has three subviews. Where should I reposition and resize those three 
 subviews when the NSWindow size changes? 
>> 
 I see that NSView has a "layout" method that can be overridden but AFAIU 
 this is only to be used for Auto Layout. I don't want to use Auto Layout 
 because my whole layout is very simplistic and just involves those three 
 subviews which I can easily position and size manually. I just need to 
 know where to put the code that sets their new position and size... anyone?
>> 
 -- 
 Best regards,
 Andreas Falkenhahn
>> 
>> 
>> 
>> 
>> -- 
>> Best regards,
>> Andreas Falkenhahnmailto:andr...@falkenhahn.com
>> 
>> ___
>> 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com 
>> 
>> 
>> This email sent to petr...@mac.com 
> 
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com 
> 
> 
> This email sent to mail...@xenonium.com 
___

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

This email sent to arch...@mail-archive.com


Re: How to reposition subviews without Auto Layout

2020-10-17 Thread Rob Petrovec via Cocoa-dev
As was pointed out by an earlier reply, even if you use -layout or 
setAutoresizingMask you are still using auto layout. The frame changes get 
converted to auto layout constraints under the hood.  If you said “without 
using Autolayout API” that would be more correct.

—Rob


> On Oct 17, 2020, at 9:46 AM, Andreas Falkenhahn via Cocoa-dev 
>  wrote:
> 
> Thanks, out of curiosity I've tried to override the "layout" method and see 
> if it works and it indeed does. So it looks like simply overriding the 
> "layout" method and doing the positioning and sizing there is also possible 
> without using any Auto Layout features whatsoever...
> 
> On 17.10.2020 at 16:30 Richard Charles wrote:
> 
>> You could call this method on your three views.
> 
>> -[NSViewView setAutoresizingMask:]
> 
>> --Richard Charles
> 
> 
>>> On Oct 17, 2020, at 6:57 AM, Andreas Falkenhahn via Cocoa-dev 
>>>  wrote:
> 
>>> Hi,
> 
>>> I have an NSView that I set as the content view of my NSWindow. The NSView 
>>> has three subviews. Where should I reposition and resize those three 
>>> subviews when the NSWindow size changes? 
> 
>>> I see that NSView has a "layout" method that can be overridden but AFAIU 
>>> this is only to be used for Auto Layout. I don't want to use Auto Layout 
>>> because my whole layout is very simplistic and just involves those three 
>>> subviews which I can easily position and size manually. I just need to know 
>>> where to put the code that sets their new position and size... anyone?
> 
>>> -- 
>>> Best regards,
>>> Andreas Falkenhahn
> 
> 
> 
> 
> -- 
> Best regards,
> Andreas Falkenhahnmailto:andr...@falkenhahn.com
> 
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com
> 
> This email sent to petr...@mac.com

___

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

This email sent to arch...@mail-archive.com


Re: How to reposition subviews without Auto Layout

2020-10-17 Thread Richard Charles via Cocoa-dev
Just curious if these three subviews are in a nib or xib file or are they 
inserted into the content view programmatically?

--Richard Charles


> On Oct 17, 2020, at 9:46 AM, Andreas Falkenhahn  
> wrote:
> 
> Thanks, out of curiosity I've tried to override the "layout" method and see 
> if it works and it indeed does. So it looks like simply overriding the 
> "layout" method and doing the positioning and sizing there is also possible 
> without using any Auto Layout features whatsoever...
> 
> On 17.10.2020 at 16:30 Richard Charles wrote:
> 
>> You could call this method on your three views.
>> 
>> -[NSViewView setAutoresizingMask:]
>> 
>> --Richard Charles
>> 
>> 
>>> On Oct 17, 2020, at 6:57 AM, Andreas Falkenhahn via Cocoa-dev 
>>>  wrote:
>>> 
>>> Hi,
>>> 
>>> I have an NSView that I set as the content view of my NSWindow. The NSView 
>>> has three subviews. Where should I reposition and resize those three 
>>> subviews when the NSWindow size changes? 
>>> 
>>> I see that NSView has a "layout" method that can be overridden but AFAIU 
>>> this is only to be used for Auto Layout. I don't want to use Auto Layout 
>>> because my whole layout is very simplistic and just involves those three 
>>> subviews which I can easily position and size manually. I just need to know 
>>> where to put the code that sets their new position and size... anyone?
>>> 
>>> -- 
>>> Best regards,
>>> Andreas Falkenhahn

___

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

This email sent to arch...@mail-archive.com


Re: How to reposition subviews without Auto Layout

2020-10-17 Thread Andreas Falkenhahn via Cocoa-dev
Thanks, out of curiosity I've tried to override the "layout" method and see if 
it works and it indeed does. So it looks like simply overriding the "layout" 
method and doing the positioning and sizing there is also possible without 
using any Auto Layout features whatsoever...

On 17.10.2020 at 16:30 Richard Charles wrote:

> You could call this method on your three views.

> -[NSViewView setAutoresizingMask:]

> --Richard Charles


>> On Oct 17, 2020, at 6:57 AM, Andreas Falkenhahn via Cocoa-dev 
>>  wrote:

>> Hi,

>> I have an NSView that I set as the content view of my NSWindow. The NSView 
>> has three subviews. Where should I reposition and resize those three 
>> subviews when the NSWindow size changes? 

>> I see that NSView has a "layout" method that can be overridden but AFAIU 
>> this is only to be used for Auto Layout. I don't want to use Auto Layout 
>> because my whole layout is very simplistic and just involves those three 
>> subviews which I can easily position and size manually. I just need to know 
>> where to put the code that sets their new position and size... anyone?

>> -- 
>> Best regards,
>> Andreas Falkenhahn




-- 
Best regards,
 Andreas Falkenhahnmailto:andr...@falkenhahn.com

___

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

This email sent to arch...@mail-archive.com


Re: How to reposition subviews without Auto Layout

2020-10-17 Thread じょいすじょん via Cocoa-dev



> On Oct 17, 2020, at 9:57 PM, Andreas Falkenhahn via Cocoa-dev 
>  wrote:
> 
> Hi,
> 
> I have an NSView that I set as the content view of my NSWindow. The NSView 
> has three subviews. Where should I reposition and resize those three subviews 
> when the NSWindow size changes? 
> 
> I see that NSView has a "layout" method that can be overridden but AFAIU this 
> is only to be used for Auto Layout. I don't want to use Auto Layout because 
> my whole layout is very simplistic and just involves those three subviews 
> which I can easily position and size manually. I just need to know where to 
> put the code that sets their new position and size... anyone?
> 
> -- 
> Best regards,
> Andreas Falkenhahn  mailto:andr...@falkenhahn.com 
> 

I'm not sure why you would avoid Auto Layout at this point. It's generally 
easier than the alternative.
Either way, Auto Layout is really the default these days and things more or 
less get to live in and Auto Layout world.

That said, what have you tried?
This method might do the trick, but there might be more involved than you 
expect.
You might want to look at the methods in NSWindowDelegate as well as the 
NSNotificationNames of NSNotifications you can register for in NSWindow.h
There are a variety of ones regarding resize and zoom.
You might also want to consider ones that involve the view being occluded or 
moving to a display with a different resolution, as well as different 
accessibility and appearance changes.
Then you have internationalization.
One of the big benefits of Auto Layout is getting fairly free support for 
left-to-right and right-to-left language layouts, and another is views that can 
automatically (mostly) expand and contract to support variations in string 
lengths by localization.
Please consider all of these points and how they might affect your layouts.
The rabbit hole is deep sometimes.
___

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

This email sent to arch...@mail-archive.com


Re: How to reposition subviews without Auto Layout

2020-10-17 Thread Richard Charles via Cocoa-dev
You could call this method on your three views.

-[NSViewView setAutoresizingMask:]

--Richard Charles


> On Oct 17, 2020, at 6:57 AM, Andreas Falkenhahn via Cocoa-dev 
>  wrote:
> 
> Hi,
> 
> I have an NSView that I set as the content view of my NSWindow. The NSView 
> has three subviews. Where should I reposition and resize those three subviews 
> when the NSWindow size changes? 
> 
> I see that NSView has a "layout" method that can be overridden but AFAIU this 
> is only to be used for Auto Layout. I don't want to use Auto Layout because 
> my whole layout is very simplistic and just involves those three subviews 
> which I can easily position and size manually. I just need to know where to 
> put the code that sets their new position and size... anyone?
> 
> -- 
> Best regards,
> Andreas Falkenhahn

___

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

This email sent to arch...@mail-archive.com


How to reposition subviews without Auto Layout

2020-10-17 Thread Andreas Falkenhahn via Cocoa-dev
Hi,

I have an NSView that I set as the content view of my NSWindow. The NSView has 
three subviews. Where should I reposition and resize those three subviews when 
the NSWindow size changes? 

I see that NSView has a "layout" method that can be overridden but AFAIU this 
is only to be used for Auto Layout. I don't want to use Auto Layout because my 
whole layout is very simplistic and just involves those three subviews which I 
can easily position and size manually. I just need to know where to put the 
code that sets their new position and size... anyone?

-- 
Best regards,
 Andreas Falkenhahn  mailto:andr...@falkenhahn.com

___

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

This email sent to arch...@mail-archive.com