Re: NSView positioning problems
Quincey you were right on the money: the new view had a wrong flag (anchored to the bottom). Thanks a lot to everyone, Andre Masse On Nov 16, 2008, at 14:41, Quincey Morris wrote: There's not quite enough information here to be certain what's going on, but in a sense it shouldn't matter *when* you do the replacement, as long as it's an *exact* replacement at the time when you do it. In particular, that means: -- setting the OutputToolbarView's frame to DummyToolbarView's frame just before you add it to OutputView's subviews -- making sure that OutputToolbarView's autoresize flags are identical to DummyToolbarView's autoresize flags, which have presumably been set up in IB to get the resizing behavior your want. I suspect that #2 is the problem here. ___ 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: NSView positioning problems
On Nov 16, 2008, at 3:30 PM, Quincey Morris wrote: On Nov 16, 2008, at 12:16, Andy Lee wrote: Does -[NSView replaceSubview:with:] take care of these? IDK, but I see nothing in the documentation to suggest that it does anything but deal with the subview ordering. Which makes me realize, if I had to ask even after checking the docs, the docs could be more clear. I've submitted feedback. --Andy ___ 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: NSView positioning problems
On Nov 16, 2008, at 12:16, Andy Lee wrote: Does -[NSView replaceSubview:with:] take care of these? IDK, but I see nothing in the documentation to suggest that it does anything but deal with the subview ordering. If it does, that would be useful information to know. ___ 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: NSView positioning problems
On Nov 16, 2008, at 2:41 PM, Quincey Morris wrote: There's not quite enough information here to be certain what's going on, but in a sense it shouldn't matter *when* you do the replacement, as long as it's an *exact* replacement at the time when you do it. In particular, that means: -- setting the OutputToolbarView's frame to DummyToolbarView's frame just before you add it to OutputView's subviews -- making sure that OutputToolbarView's autoresize flags are identical to DummyToolbarView's autoresize flags, which have presumably been set up in IB to get the resizing behavior your want. Does -[NSView replaceSubview:with:] take care of these? --Andy ___ 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: NSView positioning problems
On Nov 16, 2008, at 10:25, Andre Masse wrote: In a nib, I have a view (OutputView) which contains a table view and a custom view (OutputToolbarView) which will be loaded from another nib. This view will end up in a NSTabView. So in IB, I placed a dummy custom view above the table view like this: - | custom| - | | | table view | | | |___| In the window controller -windowDidLoad method, I load the the OutputView which loads the OutputToolbarView (each have their own NSViewControllers). Now, I tried to make the replacement in the OutputView's controller awakeFromNib method but this puts the custom view on top of the table view, positioned at the origin specified for the custom view in the nib. That's because the replacement happens before the table view had the chance to resize itself according to the window's height (I think). If instead of replacing the custom view, I add it as a subview of the dummy custom view, the origin is correct but it doesn't fill the window's width. There's not quite enough information here to be certain what's going on, but in a sense it shouldn't matter *when* you do the replacement, as long as it's an *exact* replacement at the time when you do it. In particular, that means: -- setting the OutputToolbarView's frame to DummyToolbarView's frame just before you add it to OutputView's subviews -- making sure that OutputToolbarView's autoresize flags are identical to DummyToolbarView's autoresize flags, which have presumably been set up in IB to get the resizing behavior your want. I suspect that #2 is the problem here. ___ 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: NSView positioning problems
On Nov 16, 2008, at 7:25 PM, Andre Masse wrote: Hi all, In a nib, I have a view (OutputView) which contains a table view and a custom view (OutputToolbarView) which will be loaded from another nib. This view will end up in a NSTabView. So in IB, I placed a dummy custom view above the table view like this: - | custom| - | | | table view | | | |___| In the window controller -windowDidLoad method, I load the the OutputView which loads the OutputToolbarView (each have their own NSViewControllers). Now, I tried to make the replacement in the OutputView's controller awakeFromNib method but this puts the custom view on top of the table view, positioned at the origin specified for the custom view in the nib. That's because the replacement happens before the table view had the chance to resize itself according to the window's height (I think). If instead of replacing the custom view, I add it as a subview of the dummy custom view, the origin is correct but it doesn't fill the window's width. I've read the documentation about NSView and it's companion guide but it's a big chunk to swallow and I would like to see a simple example on where to put the code for replacing a view. In both cases, you can't just replace or insert a view and hope its frame will be correct. If you want to replace the custom view, you need to: 1) Get the frame of the custom view 2) Set this frame to be the one of your replacement view (better if done before adding the view) If you want to insert your view inside the custom view, you need to: 1) Get the bounds of the custom view 2) Set these bounds to be the frame of your view (better if done before adding the view). ___ 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]