splitview location for documents...
splitview location for documents...
- Subject: splitview location for documents...
- From: Chris Moore <email@hidden>
- Date: Wed, 3 Aug 2005 10:53:53 +0900
I am writing a document-based application that has a NSSplitView as
part of it's main display. The document format I use is a keyed
NSCoder archive, and I want to store the splitview's position between
openings. I looked at http://www.cocoadev.com/index.pl?
SavingNSSplitViewPosition and tried to adapt the code to my
circumstance by saving it in my document's dataRepresentationOfType:
method like so
.....
NSString* windowFrame = NSStringFromRect([_window frame]);
[coder encodeObject:windowFrame forKey:@"WindowFrame"];
NSString* leftSideFrame = NSStringFromRect([_leftSideView frame]);
[coder encodeObject:leftSideFrame forKey:@"LeftSideFrame"];
NSString* rightSideFrame = NSStringFromRect([_rightSideView frame]);
[coder encodeObject:rightSideFrame forKey:@"RightSideFrame"];
.....
and then I try to load it again after the window is loaded like:
.....
NSRect windowFrame = NSRectFromString([decoder
decodeObjectForKey:@"WindowFrame"]);
[_window setFrame:windowFrame];
NSRect leftSideFrame = NSRectFromString([decoder
decodeObjectForKey:@"LeftSideFrame"]);
[_leftSideView setFrame:leftSideFrame];
NSRect rightSideFrame = NSRectFromString([decoder
decodeObjectForKey:@"RighSideFrame"]);
[_rightSideView setFrame:rightSideFrame];
....
And stepping through it with the debugger it appears to be working
right, but the window itself doesn't quite work right. The window's
frame gets properly restored, but the splitview's ratio stays what it
was in the nib. The subviews draw filling their whole space, but
fail to fill the whole width before wrapping lines especially visible
as you adjust the window and splitview....
Any tips?
Chris Moore
_______________________________________________
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