<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>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:  <a href="http://www.mail-archive.com/mono-osx@lists.ximian.com/msg00334.html">http://www.mail-archive.com/mono-osx@lists.ximian.com/msg00334.html</a></div><div><br></div><div>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.</div><div><br></div><div>Best Regards,</div><div>Jon...</div><div><br></div><div><br><div><div>On Feb 4, 2012, at 9:15 PM, ChunkyJr wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi -<br><br>I'm a MonoMac newbie, so my apologies if I'm being lame.  :-)<br><br>I have an objective-C Mac app that does drag and drop from a table view onto<br>another view.  Works great, no problems.   To learn MonoMac, i'm porting<br>this to C# with MonoDevelop.    I'm having a problem with<br>NSPasteboardWriting that I have spent hours trying to figure out and I'm at<br>a dead end.  I wonder if it is a bug in MonoMac.<br><br>In my NSDocument subclass, I have the following:<br><br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span>[Export("tableView:pasteboardWriterForRow:")]<br><span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span>public NSPasteboardWriting PasteboardWriterForRow(NSTableView tableView,<br>int row)<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">    </span>{<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>NSPasteboardWriting widget = widgetList[row];<br><span class="Apple-tab-span" style="white-space:pre">     </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>return widget;<br><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>}<br><br>My widget is defined like this:<br><br><span class="Apple-tab-span" style="white-space:pre">    </span>public class MacWidget : NSPasteboardWriting<br><span class="Apple-tab-span" style="white-space:pre">      </span>{<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span>public string Name { get; set; }<br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span>public string Info { get; set; }<br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span>public string Type { get; set; }<br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span><br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span>public MacWidget(string name, string info, string type)<br><span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span>{<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>this.Name = name;<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>this.Info = info;<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>this.Type = type;<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span>}<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span><br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span>public override NSObject GetPasteboardPropertyListForType (string type)<br><span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span>{<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>return new NSString(this.Type);<br><span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span>}<br><span class="Apple-tab-span" style="white-space:pre"> </span><br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span>public override string[] GetWritableTypesForPasteboard (NSPasteboard<br>pasteboard)<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span>{<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>return new string[] {"com.duffresearch.widget"};<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">    </span>}<span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span><br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span><br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span>public override NSPasteboardWritingOptions GetWritingOptionsForType<br>(string type, NSPasteboard pasteboard)<br><span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span>{<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>return (NSPasteboardWritingOptions)0;<br><span class="Apple-tab-span" style="white-space:pre">     </span><span class="Apple-tab-span" style="white-space:pre">    </span>}<br><br><span class="Apple-tab-span" style="white-space:pre">       </span>}<br><br>When I attempt to drag a cell from the table, I inexplicably get the<br>following error (edited for brevity):<br><br>*Instances of class MacWidget not valid for NSPasteboard -writeObjects:. <br>The class MacWidget does not implement the NSPasteboardWriting protocol.*<br><br>As you can see from the code above, MacWidget is declared to be a subclass<br>of NSPasteboardWriting, so how can it not be implementing the protocol??  <br><br>What am I missing?<br><br>Thank you in advance.<br><br><br><br><br><br>--<br>View this message in context: <a href="http://mono.1490590.n4.nabble.com/bug-with-NSPasteboardWriting-tp4358371p4358371.html">http://mono.1490590.n4.nabble.com/bug-with-NSPasteboardWriting-tp4358371p4358371.html</a><br>Sent from the Mono - OSX mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br>_______________________________________________<br>Mono-osx mailing list<br><a href="mailto:Mono-osx@lists.ximian.com">Mono-osx@lists.ximian.com</a><br>http://lists.ximian.com/mailman/listinfo/mono-osx<br></div></blockquote></div><br></div></body></html>