Profile Picture

Copy/Paste FailedRolledback

Posted By Ron Sawyer 14 Years Ago
Author
Message
Ron Sawyer
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 16, Visits: 1

I have created a simple custom shape. When I try to copy and paste it I get the following:

The Paste transaction FailedRolledback
Error Log:
1. Paste failed on a single node: Object reference not set to an instance of an object.

The following shape is a very simplistic-cut-down class to show what I am trying to do:

 

class TestClass : NGroup, ICloneable

{ 

      public TestClass()

      {

            // add a rectangle shape as base

            NRectangleShape rect = new NRectangleShape(new NRectangleF(0, 0, 100, 300));

            rect.DestroyShapeElements(ShapeElementsMask.All);

            rect.Protection = new NAbilities(AbilitiesMask.Select | AbilitiesMask.InplaceEdit | AbilitiesMask.Copy);

            Shapes.AddChild(rect); 

 

            // update the model bounds with the rectangle bounds        UpdateModelBounds(rect.Transform.TransformBounds(rect.ModelBounds));

 

            CreateShapeElements(ShapeElementsMask.Labels);

            NRotatedBoundsLabel label = new NRotatedBoundsLabel("", rect.UniqueId, new Nevron.Diagram.NMargins(10));

 

            Labels.AddChild(label);

            Labels.DefaultLabelUniqueId = label.UniqueId; 

      } 

 

      public TestClass(TestClass PassedClass)

      {

            NRectangleShape LclRect = PassedClass.Shapes.GetChildAt(0) as NRectangleShape;

            if (LclRect != null)

            {

                  NRectangleShape TmpRect = LclRect.Clone() as NRectangleShape;

 

                  Shapes.AddChild(TmpRect);

                  UpdateModelBounds(TmpRect.Transform.TransformBounds(LclRect.ModelBounds));

                  NRotatedBoundsLabel label = new NRotatedBoundsLabel("", TmpRect.UniqueId, new Nevron.Diagram.NMargins(10));

                  CreateShapeElements(ShapeElementsMask.Labels);

                  Labels.AddChild(label);

                  Labels.DefaultLabelUniqueId = label.UniqueId;

            }

      }

 

      object ICloneable.Clone()

      {

            return new TestClass(this);

      }

}

 






Similar Topics


Reading This Topic