[Mono-osx] bug with NSPasteboardWriting?

Jon Lipsky jon.lipsky at elevenworks.com
Sun Feb 5 03:30:56 UTC 2012


Hi,

I don't know for sure; however I believe this is a bug in MonoMac.  I ran into a very similar problem 2 weeks ago when I was trying to use the "NSPasteboardItemDataProvider" class from a MonoMac application.  Here's a link to the message I wrote about that issue:  http://www.mail-archive.com/mono-osx@lists.ximian.com/msg00334.html

It's getting to be a blocking issue for me, so I'll be spending some time on it soon.  If I find a solution, I'll let you know.

Best Regards,
Jon...


On Feb 4, 2012, at 9:15 PM, ChunkyJr wrote:

> 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:
> 
> 		[Export("tableView:pasteboardWriterForRow:")]
> 		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
> pasteboard)
> 		{
> 			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.
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-osx/attachments/20120204/6a603bb4/attachment.html>


More information about the Mono-osx mailing list