Re: Subviews of a borderless window - autoresizing mask does not work for me

2008-04-02 Thread Rob Keniger


On 03/04/2008, at 2:47 AM, Cathy Shive wrote:
The names of the margin-related masks are confusing for sure, I  
always have to look it up because when I think about the names of  
the masks and then think about the "springs and struts" UI in  
Interface Builder, I always reverse them, too.



I highly recommend Apple's "Sproing" example:

http://developer.apple.com/samplecode/Sproing

If you switch on the "geeky stuff" option, you can set the springs and  
struts and get the exact mask to use without even thinking about it.


--
Rob Keniger



___

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]


Re: Subviews of a borderless window - autoresizing mask does not work for me

2008-04-02 Thread Cathy Shive
The names of the margin-related masks are confusing for sure, I  
always have to look it up because when I think about the names of the  
masks and then think about the "springs and struts" UI in Interface  
Builder, I always reverse them, too.


On Apr 2, 2008, at 6:38 PM, Nate Weaver wrote:

Whoops, this jogged my memory. For some reason in my last response  
I thought -setAutoresizingMask specified the pinned margin and not  
the expanding margin. I'm not sure why...


On Apr 2, 2008, at 11:13 AM, Cathy Shive wrote:

Hi Hendrik,

It seems that you're using the correct mask.  The documentation  
states that NSViewMinYMargin would make the bottom margin  
flexible, which is what you want.



___

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/catshive%40gmail.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]


Re: Subviews of a borderless window - autoresizing mask does not work for me

2008-04-02 Thread Nate Weaver
Whoops, this jogged my memory. For some reason in my last response I  
thought -setAutoresizingMask specified the pinned margin and not the  
expanding margin. I'm not sure why...


On Apr 2, 2008, at 11:13 AM, Cathy Shive wrote:

Hi Hendrik,

It seems that you're using the correct mask.  The documentation  
states that NSViewMinYMargin would make the bottom margin flexible,  
which is what you want.



___

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]


Re: Subviews of a borderless window - autoresizing mask does not work for me

2008-04-02 Thread Cathy Shive

Hi Hendrik,

It seems that you're using the correct mask.  The documentation  
states that NSViewMinYMargin would make the bottom margin flexible,  
which is what you want.


I notice that you originally set the frame for the subview at (0,  
0).  Is this because the subview is originally the same size as the  
window's content view?  If not, you should calculate the proper  
origin so that the subview is positioned exactly where you want in to  
be in the window's content view before you set the autoresizing  
mask.  Also, make sure that your top margin isn't something strange.   
If, for example, the top of the subview is beyond the top of the  
window's content view when the mask is set, there will probably be  
strange behavior with autoresizing.  Double check your original  
layout code so that the subview is without a doubt completely within  
the frame of the superview.


Another long shot.  Try using the plain -(void)addSubview method  
instead of the one you're using.  I'm not sure why this would effect  
autoresizing except that it seems that it might be effecting the view  
hierarchy in some way so maybe the superview isn't autoresizing that  
view for some weird reason.  Like I said, real long shot


Good luck,
Cathy

On Apr 2, 2008, at 4:35 PM, Hendrik Holtmann wrote:


Hi,

I am creating a borderless window in source like this:

containerWindow = [[[ContainerWindow alloc]  
initWithContentRect:NSMakeRect 
(rect.origin.x,rect.origin.y-22-34,387,34)  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO] retain];


Then I add a custom view (created in interface builder) as a  
subview using the following code:


NSRect frame = [mySearchView bounds];
[mySearchView setFrame:NSMakeRect 
(0.0,0,frame.size.width,frame.size.height)];
[[containerWindow contentView] addSubview:mySearchView positioned:1  
relativeTo:nil];

[mySearchView setNeedsDisplay:YES];

That works fine. I want the customs subview position to be fixed  
now, so when resizing occurs it does not change its position and  
stays fixed to the upper left corner of the window.

Therefore I used
[[containerWindow contentView] setAutoresizesSubviews:YES];
[mySearchView setAutoresizingMask:NSViewMinYMargin];

According to the documentation this should be the right way to do  
it (hopefully). Then I change the height of containerWindow in  
source using:

NSRect frame = [containerWindow frame];
frame.size.height += 200;
frame.origin.y -= 200;
[containerWindow setFrame: frame display: YES animate: NO];
What happens now is that mySearchView moves to the buttom of the  
window. What I would like to achieve is that its fixed to the top  
of the window (left corner). Obviously the autoresizing mask does  
not work here?

Did I miss something? any help would be appreciated!

Best,

Hendrik
___

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/catshive%40gmail.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]


Re: Subviews of a borderless window - autoresizing mask does not work for me

2008-04-02 Thread Nate Weaver
You probably want to use NSViewMaxYMargin instead of NSViewMinYMargin  
(NSViewMinYMargin is the bottom margin of the content view and not the  
top).


On Apr 2, 2008, at 9:35 AM, Hendrik Holtmann wrote:

Hi,

I am creating a borderless window in source like this:

containerWindow = [[[ContainerWindow alloc]  
initWithContentRect:NSMakeRect 
(rect.origin.x,rect.origin.y-22-34,387,34)  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO] retain];


Then I add a custom view (created in interface builder) as a subview  
using the following code:


NSRect frame = [mySearchView bounds];
[mySearchView  
setFrame:NSMakeRect(0.0,0,frame.size.width,frame.size.height)];
[[containerWindow contentView] addSubview:mySearchView positioned:1  
relativeTo:nil];

[mySearchView setNeedsDisplay:YES];

That works fine. I want the customs subview position to be fixed  
now, so when resizing occurs it does not change its position and  
stays fixed to the upper left corner of the window.

Therefore I used
[[containerWindow contentView] setAutoresizesSubviews:YES];
[mySearchView setAutoresizingMask:NSViewMinYMargin];

According to the documentation this should be the right way to do it  
(hopefully). Then I change the height of containerWindow in source  
using:

NSRect frame = [containerWindow frame];
frame.size.height += 200;
frame.origin.y -= 200;
[containerWindow setFrame: frame display: YES animate: NO];
What happens now is that mySearchView moves to the buttom of the  
window. What I would like to achieve is that its fixed to the top of  
the window (left corner). Obviously the autoresizing mask does not  
work here?

Did I miss something? any help would be appreciated!

Best,

Hendrik


___

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]


Subviews of a borderless window - autoresizing mask does not work for me

2008-04-02 Thread Hendrik Holtmann

Hi,

I am creating a borderless window in source like this:

containerWindow = [[[ContainerWindow alloc]  
initWithContentRect:NSMakeRect 
(rect.origin.x,rect.origin.y-22-34,387,34)  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO] retain];


Then I add a custom view (created in interface builder) as a subview  
using the following code:


NSRect frame = [mySearchView bounds];
[mySearchView  
setFrame:NSMakeRect(0.0,0,frame.size.width,frame.size.height)];
[[containerWindow contentView] addSubview:mySearchView positioned:1  
relativeTo:nil];

[mySearchView setNeedsDisplay:YES];

That works fine. I want the customs subview position to be fixed now,  
so when resizing occurs it does not change its position and stays  
fixed to the upper left corner of the window.

Therefore I used
[[containerWindow contentView] setAutoresizesSubviews:YES];
[mySearchView setAutoresizingMask:NSViewMinYMargin];

According to the documentation this should be the right way to do it  
(hopefully). Then I change the height of containerWindow in source  
using:

NSRect frame = [containerWindow frame];
frame.size.height += 200;
frame.origin.y -= 200;
[containerWindow setFrame: frame display: YES animate: NO];
What happens now is that mySearchView moves to the buttom of the  
window. What I would like to achieve is that its fixed to the top of  
the window (left corner). Obviously the autoresizing mask does not  
work here?

Did I miss something? any help would be appreciated!

Best,

Hendrik
___

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]