[Mono-osx] bug with NSPasteboardWriting?

ChunkyJr timnichols at mac.com
Sun Feb 5 03:15:16 UTC 2012

Hi -

I'm a MonoMac newbie, so my apologies if I'm being lame.  :-)

I have an objective-C Mac app that does drag and drop from a table view onto
another view.  Works great, no problems.   To learn MonoMac, i'm porting
this to C# with MonoDevelop.    I'm having a problem with
NSPasteboardWriting that I have spent hours trying to figure out and I'm at
a dead end.  I wonder if it is a bug in MonoMac.

In my NSDocument subclass, I have the following:

		public NSPasteboardWriting PasteboardWriterForRow(NSTableView tableView,
int row)
			NSPasteboardWriting widget = widgetList[row];
			return widget;

My widget is defined like this:

	public class MacWidget : NSPasteboardWriting
		public string Name { get; set; }
		public string Info { get; set; }
		public string Type { get; set; }
		public MacWidget(string name, string info, string type)
			this.Name = name;
			this.Info = info;
			this.Type = type;
		public override NSObject GetPasteboardPropertyListForType (string type)
			return new NSString(this.Type);
		public override string[] GetWritableTypesForPasteboard (NSPasteboard
			return new string[] {"com.duffresearch.widget"};
		public override NSPasteboardWritingOptions GetWritingOptionsForType
(string type, NSPasteboard pasteboard)
			return (NSPasteboardWritingOptions)0;


When I attempt to drag a cell from the table, I inexplicably get the
following error (edited for brevity):

*Instances of class MacWidget not valid for NSPasteboard -writeObjects:. 
The class MacWidget does not implement the NSPasteboardWriting protocol.*

As you can see from the code above, MacWidget is declared to be a subclass
of NSPasteboardWriting, so how can it not be implementing the protocol??  

What am I missing?

Thank you in advance.

View this message in context: http://mono.1490590.n4.nabble.com/bug-with-NSPasteboardWriting-tp4358371p4358371.html
Sent from the Mono - OSX mailing list archive at Nabble.com.

More information about the Mono-osx mailing list