Re: Place NSView into NSView

2008-04-06 Thread Jens Alfke
On 5 Apr '08, at 4:47 PM, Lincoln Green wrote: [secondView setFrame:[firstView frame]]; This should be [secondView setFrame:[firstView bounds]]; The frame is the view's rectangle in its parent's coordinate system; the bounds is its rect in its own coordinates. So secondView

Re: Place NSView into NSView

2008-04-05 Thread I. Savant
And I'll add to your addition that [secondView display] isn't likely to be the correct way to get the view to draw. In that context, it should be [secondView setNeedsDisplay:YES]. Or, rather, since it's going to display anyway (just having being added to a view hierarchy), the call can be o

Re: Place NSView into NSView

2008-04-05 Thread Quincey Morris
On Apr 5, 2008, at 17:13, I. Savant wrote: ADDING: Think also about what coordinate system you're using when you tell a subview to set its frame to a superview's frame. Per the documentation, you'll want to set the subview's frame to the superview's *bounds*, not its frame (since the s

Re: Place NSView into NSView

2008-04-05 Thread I. Savant
Of course my response was incomplete, sorry. I meant to add this: Pay particular attention to the "Working with the View Hierarchy" section. // Set viewB's frame to the desired rect, then ... [viewA addSubview:viewB]; ADDING: Think also about what coordinate system you're using when

Re: Place NSView into NSView

2008-04-05 Thread I. Savant
Is there a way to place one NSView into another NSView? This is what I have. Read the documentation: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/Introduction/chapter_1_section_1.html Pay particular attention to the "Working with the View Hierarchy" section.