Bug 9344 - in MonoMac, the method SetMinCoordinateofSubview of splitviewDelegate is never called for pane at the right of the split view.
Summary: in MonoMac, the method SetMinCoordinateofSubview of splitviewDelegate is neve...
Status: RESOLVED ANSWERED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: Master
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 2.0.x
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2013-01-07 16:58 UTC by micrond
Modified: 2015-02-19 16:53 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description micrond 2013-01-07 16:58:33 UTC
I put a vertical splitview on my main windows. I want to make sure neither size is reduce more than a certain limit, so I add a delegate to it:
		//strongly typed window accessor
		public override void AwakeFromNib () {
			splitView.Delegate = new MainSplitViewDelegate ();
		}

Here is my Split View delegate class:
	public class MainSplitViewDelegate : NSSplitViewDelegate
	{
		readonly int[] MIN_WIDTH_PANE = {219, 300}; 

		public MainSplitViewDelegate () {
		}


		/// <summary>
		/// Shoulds the size of the adjust.
		/// </summary>
		/// <returns>
		/// <c>true</c>, if adjust size was shoulded, <c>false</c> otherwise.
		/// </returns>
		/// <param name='splitView'>
		/// Split view.
		/// </param>
		/// <param name='view'>
		/// View.
		/// </param>
		/// \note used when resizing window
		public override bool ShouldAdjustSize (NSSplitView splitView, NSView view) {
			if (view == splitView.Subviews [0])
				return false;
			else 
				return (view.Frame.Size.Width > MIN_WIDTH_PANE [1]);
		}

		/// <summary>
		/// Sets the minimum coordinateof subview.
		/// </summary>
		/// <returns>
		/// The minimum coordinateof subview.
		/// </returns>
		/// <param name='splitView'>
		/// Split view.
		/// </param>
		/// <param name='proposedMinimumPosition'>
		/// Proposed minimum position.
		/// </param>
		/// <param name='subviewDividerIndex'>
		/// Subview divider index.
		/// </param>
		/// \note called for left pane when dragging view handle
		public override float SetMinCoordinateofSubview (NSSplitView splitView, float proposedMinimumPosition, int subviewDividerIndex) {
			//if (subviewDividerIndex != 0)
			//	throw new System.NotImplementedException ();
			return MIN_WIDTH_PANE [subviewDividerIndex];
		}
	}

The error occurs in SetMinCoordinateofSubview. My goals was to make sure that neither side width is below MIN_WIDTH_PANE. The code above shows that the call to SetMinCoordinateofSubview is never done for the right pane because if we remove the comments, the exception is never thown which make it impossible to validate right pane min size.
Comment 2 Chris Hamons 2015-02-19 16:53:33 UTC
Micrond,

Sorry for the long delay in responding to this bug. It was misfiled and overlooked until now.

I took a look at your issue, and I don't believe it is a bug. If you add 3 items to your split view:

https://gist.github.com/chamons/9d7b43723c78f8747e8e

We do get the call in question. While NSSplitView is not obvious to use, we're correctly passing the calls Cocoa is making up to the user program.

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSSplitViewDelegate_Protocol/

If you are having trouble using an API, check out the forms for a place you can get some help:

http://forums.xamarin.com/categories/mac