Nevron Forum

NTextShape Double click and type text

https://www.nevron.com/Forum/Topic7860.aspx

By Steve Warner - Wednesday, June 12, 2013

When creating a NTextShape on a diagram, we always replace the text with "DEFAULT" and disable the ability to double-click the shape and type your text (We want to handle the text in the shape via the tag) Is there a way to make the NTextShape never show the "Double click and type text" text? It is confusing to our users.
By Nevron Support - Wednesday, June 12, 2013

Hi,

From your description it appears that you are using the create text shape tool to create text shapes. If that's the case you can create a class that inherits NDiagramElementFactory and assign it to the ElementFactory property of the drawing view. All you have to do in your custom element factory class is to override the CreateText method like this:

public override NTextShape CreateText(bool preview)

{

    return new NTextShape();

}

By Steve Warner - Wednesday, June 12, 2013

When I do that, the preview box no longer shows. My users need the box to show. I would like to override the preview text though.
By Nevron Support - Wednesday, June 12, 2013

Then simply set the text you want to the text shape:

public override NTextShape CreateText(bool preview)

{

    NTextShape textShape = new NTextShape();

    textShape.Text = "Your text here";

    return textShape;

}