Re: Baffling Button Behavior
Re: Baffling Button Behavior
- Subject: Re: Baffling Button Behavior
- From: Fritz Anderson <email@hidden>
- Date: Sun, 18 Apr 2010 15:24:22 -0500
On 17 Apr 2010, at 4:32 PM, email@hidden wrote:
> I have two buttons in a view, side by side. Their autoresizingMask are both NSViewMaxXMargin + NSViewMaxYMargin
>
> When their containing view is resized only the left button behaves properly. The right button stays fixed.
>
> Why?
>
> Before resize:http://highrolls.net/Before Resize.png
>
> After resize:http://highrolls.net/After Resize.png
I wish you had provided the real URLs (e.g. <http://highrolls.net/After Resize.png>).
I also wish your screen shots showed the enclosing window, so I could tell what resizing was done. Group: There are two buttons visible, "Save" on the left, and "Save As…" on the right. In the "before" picture, they appear side-by-side, with a normal amount of space between them. In the "after" picture, which I _assume_ comes after the window was resized to be narrower, "Save" (left) is the same x-distance from the left margin (visually stationary); "Save As…" (right) has moved to the left so it is under, and half-covered by, "Save."
The most obvious explanation is that the resizing mask for "Save As…" contains NSViewMinXMargin (flexible on left) and not NSViewMaxXMargin (flexible on right), despite your intention.
Things to try:
I would like to see your code in which you set the autoresizing masks, for both buttons. Or if it was done in Interface Builder, please double-check the resizing settings.
Verify that the two buttons are embedded in the same view.
In the debugger, set a breakpoint in some code where you have access to pointers to the two buttons, after their resizing masks have been set. If you really are using setAutoResizingMask:, breaking right after the second call would do. Then use the Debugger Console for these two commands:
p/d (int) [saveButton autoresizingMask]
p/d (int) [saveAsButton autoresizingMask]
My bet is the two numbers are different.
— F
_______________________________________________
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