Copy - Paste problem (V2.4.1)


Copy-Paste does not work in my application.

The informations I can give are the following:

  • Ctrl-Drag of selection to make a copy in same view works.

  • Copy-Paste of GoDiagramComment does not work, so I think is not a serialisation problem.

  • I overrided CopyToClipboard,
    public override void CopyToClipboard(IGoCollection coll)

     The coll object seems correct.
  • I overrided CreateDataObject,
    protected override DataObject CreateDataObject(IGoCollection coll, GoDocument clipdoc)
    DataObject l_DataObject = base.CreateDataObject(coll, clipdoc);
    return l_DataObject;

       The coll and clipdoc objects seems correct.
        The created DataObject seems correct, with the InnerData in 3     formats (Bitmap, UnicodeText and <MyDocumentType>.

If I paste in a text editor, I get objects labels, so copy seems working.

  • I overrided CanInsertObjects,
    public override bool CanInsertObjects()
    bool l_ok = base.CanInsertObjects();
    return l_ok;

      When I paste, CanInsertObjects returns true.
  • I overrided PasteFromClipboard,
    public override GoCopyDictionary PasteFromClipboard()
    GoCopyDictionary l_Copy = base.PasteFromClipboard(); // NULL
    return l_Copy;

      When I paste base.PasteFromClipboard() return null;

Could you please give me some advices or things to test to give you mor info ?




Actually, it does sound like a serialization problem. Try serializing to and from a file: See if you get any errors.

Also, you should have gotten some trace listener messages if there had been any caught exceptions. Look in Visual Studio's Output window, or implement your own trace listener.
CopyToClipboard puts the selection in various formats into the clipboard. The text format is just a list of all the IGoLabeledPart.Text strings. The bitmap format is a bitmap rendering of the selection. (Try an Edit | Paste Special command in those applications that support pasting in various formats.) And most importantly there is a custom clipboard format holding the "real" GoDiagram data, as specified by GoDocument.DataFormat.
Since you seem to have all three format data in the clipboard, and only PasteFromClipboard seems to fail, it's almost certainly a serialization problem.

Has usual you was right Walter!

I forget to set a member as [NonSerialized]…