Re: NSDrawer, IB "springs", etc.
Re: NSDrawer, IB "springs", etc.
- Subject: Re: NSDrawer, IB "springs", etc.
- From: Keith Renz <email@hidden>
- Date: Fri, 23 Aug 2002 13:13:32 -0400
Bill,
Thanks for the reply.
I've read everything very carefully and my understanding of IB's autosizing
area is the same as yours. But, it just doesn't work properly in this case,
or there's something more going on (more on this later).
I have gone back and laid out two simple custom views, both the same subclass
of NSView, which automatically draw their bounds graphically and display
their coordinates numberically using the drawRect: method -- good for getting
a handle on this. One custom view is now the drawer's content view and the
other is a subview of the the drawer's content view.
So, theoretically, to keep the subview in constant relative position to the
drawer (on window's right edge), I need to have the interior springs
straight, the right and top margin springs straight and the left and bottom
margin springs coiled.
Assume the drawer is open and we're not messing with the window size. All
works well while dragging the drawer closed (to the left) until the left edge
of the subview hits the right edge of the window. Then the subview's frame's
left edge gets pinned against the window's right edge. I can see this
happening graphically and by watching the frame rect's numeric values
changing, i.e. the frame starts sliding on the superview. Then the frame's
left edge remains at zero and will not go negative, which would allow it to
visually slide under the window, and the right edge goes off the superview's
right edge.
So, in summation, the subview's movement is what I want until it's left edge
hits the window's right edge. Then it slides off the drawer's right edge.
Additionally, I can get it to work visually perfect if I set the min and max
size of the drawer's content view to the same size as the current size, but
then the drawer will not stay in any intermediate position -- it's either
open or closed. So, it's not really a solution.
It's a sticky situation and the only way I can see fixing it is
programatically via a delegate method.
Also, in reference to your 4th point, no matter what I do with the drawer's
content view's springs (the interior ones), the content view resizes, frame
and bounds (I'm watching the numbers in real time). It just does it and
there's nothing you can do about it.
By the way, I read Vermont Recipies about a year ago when I started getting
into Cocoa. Glad to see you're going to publish it!
Keith
-----
On 8/22/02, 6:26 PM, Bill Cheeseman <email@hidden> wrote:
>
on 02-08-22 4:34 PM, Keith Renz at email@hidden wrote:
>
>
> The drawer's content size is set at 235 with a min = 0 and a max = 300.
>
>
>
> I have tried every combination of IB's springs for the view, tables and
>
> buttons to get the behavior I want. I thought I understood what they mean,
>
> but I guess I don't.
>
>
>
> Can someone please give me a definitive explanation of the springs and
what I
>
> need to do to pin my drawer's contents to the drawer?
>
>
I can't be definitive, but I just worked my way through the same issues and
>
can make a few suggestions.
>
>
1. Drawers are resizable -- horizontally in your case -- by dragging the
>
edge. So keep that in mind while setting up your springs.
>
>
2. Drawers are resized (but not resizable by the user) at run time to fit
>
the calculated vertical height required by some internal formula related to
>
the current height of the parent window. So keep that in mind.
>
>
3. The origin of the drawer's DrawContentView is the bottom-left corner. So,
>
to keep the margin between user controls and the top edge of the
>
DrawContentView constant when the inevitable automatic vertical resizing of
>
the drawer takes place, you have to keep the margin spring at the top of the
>
DrawContentView uncoiled (straight), and the bottom margin spring or the
>
vertical resizing spring coiled. Then the top margin will remain constant,
>
and the views will grow or resize downwards at run time.
>
>
4. Point 3 applies to the DrawContentView within the drawer, too, as I
>
recall. You want a fixed 0 margin at all four edges and springs in the
>
middle box to let the DrawContentView grow and shrink with the drawer, as I
>
recall.
>
>
Hope this helps.
>
>
--
>
>
Bill Cheeseman - email@hidden
>
Quechee Software, Quechee, Vermont, USA
>
http://www.quecheesoftware.com
>
>
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
>
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
>
Croquet Club of Vermont - http://members.valley.net/croquetvermont
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.