Skip navigation.
 
mlRe: Help needed in NSSplitView
FROM : I. Savant
DATE : Thu Jun 29 17:33:40 2006

Vinay:

  If you're only trying to keep the user from making one or another 
pane too small, just use -
splitView:constrainSplitPosition:ofSubviewAt: like this ...

- (float)splitView:(NSSplitView *)sender constrainSplitPosition:
(float)proposedPosition ofSubviewAt:(int)offset
{
    if (proposedPosition < 200)
        return 200;
    if (proposedPosition > NSWidth([sender frame]) - 200)
        return NSWidth([sender frame]) - 200;
    return proposedPosition;
}

  This checks to see if the split position is at less than 200 
pixels to the left (or top, depending on the orientation of your 
split view). If so,  return 200. It then checks to see if the 
position is greater than the total width of the split view minus 200 
pixels, returning that value if this is true. As long as 
proposedPosition is between those two values, it's left untouched.

  This "constrains" the splitter so that neither panel (in a two-
panel split view) can be any smaller than 200 pixels in width or 
height (again, depending on orientation). If you have a split view 
with more than two panes, use the offset to find out which splitter 
is being moved, then react accordingly. You're "constraining" the 
splitter's position using this method and should not need the -
splitView:resizeSubviewsWithOldSize: method at all.

  I hope this was clear.

--
I.S.


On Jun 29, 2006, at 11:08 AM, Vinay Prabhu wrote:

> Here is the code,
> This method will restrict the resizing, but it will block the
> interaction with the controls inside the view...
>
> - (void)splitView:(NSSplitView *)sender
> resizeSubviewsWithOldSize:(NSSize)oldSize
> {
>     int iCount = 0;
>     NSArray* subviews = [sender subviews];
>     int subcount = [subviews count];
>     id temp[subcount];
>     for(iCount = 0; iCount < subcount; iCount++)
>     {
>         [temp[iCount] setFrameSize:oldSize];
>     }
>     [sender adjustSubviews];
> }
>
> -----Original Message-----
> From: I. Savant [mailto:<email_removed>]
> Sent: Thursday, June 29, 2006 8:26 PM
> To: Vinay Prabhu
> Cc: <email_removed>
> Subject: Re: Help needed in NSSplitView
>
>
>
>    How? Post your code. :-)
>
> --
> I.S.
>
>
> On Jun 29, 2006, at 10:08 AM, Vinay Prabhu wrote:
>

>> I have tried implementing all the delegate method's.

>
> The information contained in this electronic message and any 
> attachments to this message are intended for the exclusive use of 
> the addressee(s)and may contain confidential or privileged 
> information. If you are not the intended recipient, please notify 
> the sender or <email_removed>

Related mailsAuthorDate
mlHelp needed in NSSplitView Vinay Prabhu Jun 29, 16:08
mlRE: Help needed in NSSplitView Mradul Mandhanya Jun 29, 16:18
mlRe: Help needed in NSSplitView I. Savant Jun 29, 16:55
mlRE: Help needed in NSSplitView Vinay Prabhu Jun 29, 17:08
mlRe: Help needed in NSSplitView I. Savant Jun 29, 17:33
ml[SOLVED]Help needed in NSSplitView Vinay Prabhu Jun 29, 17:40