Profile Picture

Preventing Editing of a custom shape

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 a custom shape descended from NGroup. When I double click on it, an in-place editor pops up. (See attachment). I want to prevent this. I have tried setting the protection of both the shape and the rectangle (sample code of setting rectangle protection.) I have tried both true and false.

NAbilities protection = rect.Protection;

protection.InplaceEdit = true;



On a related note (I think) once the in-place editor has been invoked, the rectangle seems to separate from the shape when I drag it. (See second part of attachment) I want to prevent this as well. I have tried setting protection.ungroup.

[Serializable]

class TestClass : NGroup

{

      NRectangleShape rect;

      public TestClass()

      {

            // add a rectangle shape as base

            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));

      }

}



Attachments
Shape.zip (84 views, 17.00 KB)
Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi,

The correct way to set the protections of any shape or group is to get them first, then modify them and finally assign them back to the shape. For example:

 

NAbilities protection = rect.Protection;

protection.InplaceEdit = true;

rect.Protection = protection;

 

If you want to disable the nodes in the group to be moved you can apply the MoveX and MoveY protections or the Select protection on them.



Best Regards,
Nevron Support Team



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

rect.Protection = protection;


Ah, that's the part that I was missing!

Thanks, I'll give it a try.



Similar Topics


Reading This Topic