[SOLVED]Help needed in NSSplitView
[SOLVED]Help needed in NSSplitView
- Subject: [SOLVED]Help needed in NSSplitView
- From: Vinay Prabhu <email@hidden>
- Date: Thu, 29 Jun 2006 21:10:53 +0530
- Importance: Normal
Hi,
splitView:constrainSplitPosition:ofSubviewAt:
did the job,
thanks to all for the help...
Regards
Vinay
-----Original Message-----
From: I. Savant [mailto:email@hidden]
Sent: Thursday, June 29, 2006 9:04 PM
To: Vinay Prabhu
Cc: email@hidden
Subject: Re: Help needed in NSSplitView
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@hidden]
> Sent: Thursday, June 29, 2006 8:26 PM
> To: Vinay Prabhu
> Cc: email@hidden
> 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@hidden
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@hidden
_______________________________________________
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