view hierarchy confusion
view hierarchy confusion
- Subject: view hierarchy confusion
- From: Michael Hanna <email@hidden>
- Date: Wed, 26 Jan 2005 17:57:28 -0500
I have an outline view I want to appear later. so in my awakeFromNib:
// remove web search outlineview from superview until the user needs it
myDocSuperview = [[outlineView enclosingScrollView] superview];
[[outlineView enclosingScrollView] retain];
[[outlineView enclosingScrollView] removeFromSuperview];
and I re-add it like this:
NSLog(@"[myDocSuperview subviews], %@", [myDocSuperview subviews]);
// make sure the outline view isn't already a subview before adding it
viewEn = [[myDocSuperview subviews] objectEnumerator];
while(viewMember = [viewEn nextObject])
if(viewMember == [outlineView enclosingScrollView])
outlineViewPresent = YES;
if(!outlineViewPresent)
{
[myDocSuperview addSubview:[outlineView enclosingScrollView]];
[[outlineView enclosingScrollView] setNeedsDisplay:NO];
[[outlineView enclosingScrollView] displayIfNeeded];
[[outlineView enclosingScrollView] setFrame:NSMakeRect(
[myScrollingView frame].origin.x,
[myScrollingView frame].origin.x+61, // seems to work
[myScrollingView frame].size.width,
[myScrollingView frame].size.height)];
[[outlineView enclosingScrollView] release];
}
[outlineView reloadData];
the nsoutlineview shares the window with an
NSTextView(myScrollingView). If the NSTextView is empty when I re-add
the NSOutlineView, the NSOutlineView appears on top of the NSTextView.
However, if the NSTextView has content that is clipped and the scroll
thumbs are present on it, adding the NSOutlineView causes
unexpected(for me)side-effects. If the NSOutlineView has scrolling
content, then the top 2/3 of the NSOutlineView is past the top of the
view, with no scroll bar. If I scroll the thumb for the NSTextView, it
will not only scroll the text inside it, but also the NSOutlineView!
It appears that when the NSOutlineView gets re-added, it gets re-added
to the same NSScrollView as the NSTextView?? I'm not sure what's going
on here. Any suggestions on what pit I'm falling in here?
o/p:
[myDocSuperview subviews], <CFArray 0x352ea0 [0xa01900e0]>{type =
mutable-small, count = 15, values = (
0 : <RangeSlider: 0x349390>
1 : <NSTextField: 0x34a1b0>
2 : <NSButton: 0x348ee0>
3 : <ArrowButton: 0x34ba80>
4 : <ArrowButton: 0x34c020>
5 : <ArrowButton: 0x34c140>
6 : <NSSlider: 0x34c3b0>
7 : <NSButton: 0x34ab60>
8 : <NSImageView: 0x34cf20>
9 : <NSButton: 0x34d960>
10 : <NSImageView: 0x34bf80>
11 : <NSScrollView: 0x34dd90>
12 : <TAOOpenGLView: 0x34f030>
13 : <NSButton: 0x352c40>
14 : <NSMovieView: 0x352dd0>
)}
regards,
Michael
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden