FROM : Milen Dzhumerov
DATE : Fri Mar 28 23:40:44 2008
On 28 Mar 2008, at 22:34, Vladimir Sokolov wrote:
> Hi All.
>
> How can I make fixed width of the left pane in the NSSplitView?
> I want to make it as in iTunes. When user resize a window only right
> pane should change width.
>
Hi Vladimir,
Your split view delegate should implement the following method:
-(void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:
(NSSize)oldSize
{
CGFloat dividerThickness = [sender dividerThickness];
NSRect leftRect = [[[sender subviews] objectAtIndex:0] frame];
NSRect rightRect = [[[sender subviews] objectAtIndex:1] frame];
NSRect newFrame = [sender frame];
leftRect.size.height = newFrame.size.height;
leftRect.origin = NSMakePoint(0, 0);
rightRect.size.width = newFrame.size.width - leftRect.size.width
- dividerThickness;
rightRect.size.height = newFrame.size.height;
rightRect.origin.x = leftRect.size.width + dividerThickness;
[[[sender subviews] objectAtIndex:0] setFrame:leftRect];
[[[sender subviews] objectAtIndex:1] setFrame:rightRect];
}
Regards,
Milen
> Thanks!
>
> - Vladimir
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
DATE : Fri Mar 28 23:40:44 2008
On 28 Mar 2008, at 22:34, Vladimir Sokolov wrote:
> Hi All.
>
> How can I make fixed width of the left pane in the NSSplitView?
> I want to make it as in iTunes. When user resize a window only right
> pane should change width.
>
Hi Vladimir,
Your split view delegate should implement the following method:
-(void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:
(NSSize)oldSize
{
CGFloat dividerThickness = [sender dividerThickness];
NSRect leftRect = [[[sender subviews] objectAtIndex:0] frame];
NSRect rightRect = [[[sender subviews] objectAtIndex:1] frame];
NSRect newFrame = [sender frame];
leftRect.size.height = newFrame.size.height;
leftRect.origin = NSMakePoint(0, 0);
rightRect.size.width = newFrame.size.width - leftRect.size.width
- dividerThickness;
rightRect.size.height = newFrame.size.height;
rightRect.origin.x = leftRect.size.width + dividerThickness;
[[[sender subviews] objectAtIndex:0] setFrame:leftRect];
[[[sender subviews] objectAtIndex:1] setFrame:rightRect];
}
Regards,
Milen
> Thanks!
>
> - Vladimir
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Vladimir Sokolov | Mar 28, 23:34 | |
| Milen Dzhumerov | Mar 28, 23:40 | |
| Vladimir Sokolov | Mar 28, 23:58 | |
| Jens Alfke | Mar 29, 00:00 |






Cocoa mail archive

