Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Remembering + setting multiple split view divider position



Hi all,

Just an update...  Partway there...  Rather than do the Boolean check to see
if the Split View was vertical, I decided to do something a little more
within my Cocoa comfort zone, and create alternate functions within the same
file, one set for horizontal and one for vertical.

Then I filled in the gaps and realized that the iriginal post had clear
instructions embedded in the comments as to how to convert the
setSplitViewPosition: routine to handle vertical dividers.  It worked!  For
the vertical divider, anyway.

So I can save the left (horizontal) divider, and the middle (vertical)
divider.  Can anyone think why I wouldn't be able to save the right
(horizontal) divider in the same way?

I get the following errors when I go to save the settings:
*** -[NSSplitView count]: selector not recognized [self = 0x368460]
"SaveSplitDividers error: NSInternalScriptError"

For reference, here is the vertical-modified setPosition function:

==================================================
- (void) setSplitViewPositionV: (NSSplitView *) splitView position:
(NSString *) s
{
NSArray *subViews = [splitView subviews];
NSRect newBounds;
float dividerWidth = [splitView dividerThickness];
NSView *viewZero = [subViews objectAtIndex: 0];
NSView *viewOne = [subViews objectAtIndex: 1];
NSArray *stringComponents = [s componentsSeparatedByString: @" "];
int valueZero, valueOne;

valueZero = [[stringComponents objectAtIndex: 0] intValue];    valueOne =
[[stringComponents objectAtIndex: 1] intValue];

int leftSize = valueZero;
int rightSize = valueOne;

if ((leftSize + rightSize + dividerWidth) != [splitView frame].size.width)
leftSize = [splitView frame].size.width - dividerWidth - rightSize;

newBounds = [viewZero frame];
newBounds.size.width = leftSize; // leftSize for vertical divider
newBounds.origin.x = 0;
[viewZero setFrame: newBounds];

newBounds = [viewOne frame];
newBounds.size.width = rightSize;    // rightSize for vertical divider
newBounds.origin.x = leftSize + dividerWidth; // leftSize for vertical
[viewOne setFrame: newBounds];
}
==================================================

Any ideas?  One clue might be...  When I was building the foundation of the
app, somehow the right split view got nested, and the left one didn't---  I
refer to a scroll view in the left one by:
scroll view "saved_searches" of split view "LeftView" of split view
"AllViews" of gTheWindow

Yet the right one I must refer to by:
scroll view "recordings" of split view "RightView" of split view "RightView"
of split view "AllViews" of gTheWindow

Note the two "RightView", one inside the other---  could this be the
culprit?  If so, how to I un-nest it?

Thanks,
Graham Jones.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.