Problems with edit text bounding box cell inside a NSOutlineView
Problems with edit text bounding box cell inside a NSOutlineView
- Subject: Problems with edit text bounding box cell inside a NSOutlineView
- From: email@hidden
- Date: Mon, 3 Jan 2011 17:19:19 +0000 (GMT)
I sent the following just before Christmas and haven't had any response. Hopefully now it is a New Year there will be more people around and someone can help.
Kevin
Hi,
I am having trouble with the edit text bounding box for both a NSTextFieldCell and a ImageAndTextCell. The cells are used in a NSOutlineView which has a single NSTableColumn.
There are two Interface builder nib files that define the window. The first which is simple defines the window itself (NSWindow) and a single placeholder NSView which fills the content region of the window. The second is a NSView that contains a NSScrollView which contains an NSOutlineView with the single NSTableColumn.
At run time the application loads the window defined in interface builder, in the awakeFromNib message for the NSWindowController I have the following code which loads the second nib file by creating its view controller and inserts the view into the window's placeholder view.
sitePanelController = [[FWSitePanelViewController alloc] initWithDocument:[self document]];
[sitePanelPlaceHolderView addSubview:[sitePanelController view]];
After doing this and adding some content for the NSOutlineView if the cells are NSTextFieldCell then the bounding box for editing text is correct for top level items is fine, but for all other items the edit text bounding box on the right hand edge is clipped by the vertical scroller of the NSScrollView. If the cells are defined by the class ImageAndTextCell then the bounding box for all items even top level items are clipped by the vertical scroller. This can create some odd text editing behaviour as the insertion point disappears.
If the original view containing the NSScrollView was wider than the window then resizing the window using the mouse to be wider than interface builder defined width for the NSScrollView then suddenly the bounding box for the edit text fields works. Once it works it is fine and you can resize the window back down to be less than the width and everything works fine.
All the views are setup to autoresize appropriately when changing the size of their superview and this clearly works correctly after the window is resized using the mouse to be big enough for the first time.
I have tried all sorts of things to get this to work without success. I added the following code to the awakeFromNib message (originally only the first line of the code):
[[sitePanelController view] setFrame:[sitePanelPlaceHolderView frame]];
NSSize viewSize = [[sitePanelController view] frame].size;
CGFloat widthDiff = [[sitePanelController view] frame].size.width -
[sitePanelPlaceHolderView frame].size.width;
[[sitePanelController view] setFrame:[sitePanelPlaceHolderView frame]];
NSSize frameSize = [[sitePanelController sitePanelOutline] frame].size;
frameSize.width -= widthDiff;
[[sitePanelController sitePanelOutline] setFrameSize:frameSize];
NSTableColumn *column1 = [[sitePanelController sitePanelOutline]
tableColumnWithIdentifier:@"SITEPANEL_COLUMN1"];
[column1 setWidth:[column1 width] - widthDiff];
This didn't help plus I also tried making changes to the selectWithFrame message in the ImageAndTextCell class without success. I've tried making the view defined in the second nib file, bigger, smaller, and the eact size to fit into the frame of the placeholder view in the window. None of it helps.
I kind of feel like the view/window needs to be nudged/kicked in some way to achieve the same result that I get when resizing the window using the mouse, but I'm currently at a loss.
Thoughts, help please.
Kevin
_______________________________________________
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