AddTextLine adds an extra line break

Hello,

I am trying to fill a text node with some text, I always get an extra LF character at the end. Both AddTextLine(s), InsertTextLine(1,s) and  TextLine(1)=s always do this for me.

The presence of the extra LF does not affect the rendering, but is clearly visible in the Text Editor (as a new line) and in the Element Info (as a black box after the last character)

It is saved in the file somehow, but not as a separate text element, as far as I can see.

I can easily remove the extra line in the editor, but when I modify the text node via COM or VBA, the extra line pops up again.

Is it some known feature, or am I doing something wrong? Is there any way to get rid of it?

/Ilya

 

 

 

  • Please post a code fragment that illustrates how you create a TextNodeElement and its TextElement components.

     

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Unknown said:
    Please post a code fragment that illustrates how you create a TextNodeElement and its TextElement components.

    Well, here is a self contained example in VBA

    Sub Test_TextNode
        Set oTextNode = CreateTextNodeElement1(Nothing, Point3dFromXY(20, 20), Matrix3dIdentity)
        oTextNode.AddTextLine "12345"
        ActiveModelReference.AddElement oTextNode
        oTextNode.Rewrite
    End Sub

    Here is what I get in the GUI, note the unprintable character after "12345"

  • I tried your code in V8i with no problem.

    Using oTextNode.Rewrite after ActiveModelReference.AddElement oTextNode is unnecessary, by the way.

    Non-Printing Characters

    I've blindly assumed that you've verifed that the black square in the text editor is a line-feed character. That's not necessarily so: it could be any non-printing character (e.g. tab) or a Unicode value that is not represented in your current font. Try changing the active font when you create your text to see if that makes any difference.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Jon, thank you for checking it out.

    Now I know at least that it is not intended behaviour. Whether it is a bug in V8 XM, or something weird in my installation, I hope it will disappear when I some day upgrade my system.

    The black square appears only in the Element Info, not in the Text Editor (where I get an extra line instead).

    It cannot be a Tab (which is a prinatble character and is displayed as wide space, both in Element Info and Editor); I agree that it might be some other control code like CR or even NUL, but since it is displayed as newline in the Text Editor, so effectively it is an LF.

    Best regards /E