SelText and WPRichText Margins

  • There is a difference between WPTools5 and WPTools6 that is causing me an issue.

    I am Moving text from one RichText to Another simply with:

    ToEdit.SelText := FromEdit.Text

    In the ToEdit, I have a ruler with a margin set. With WPTools5, the text new text is added at teh margin regardless of carriage returns (all new paragraphs start at teh indent margin). With WpTools6, the new text ignores the margin and inserts the text to the far left.

    Is there a way to get 6 to behave like 5? Or a better way of doing? I have tried SelectionasString, but that carries the margins of the source box with it and I do not want that.

    Thank you

  • What is latest version of 6 you are using? I have 6.21.

    To reproduce, place a button and two RichText components (from and To), each with an associated h-ruler.

    Add to the button click:
    ToRichText.SelText := FromRichText.Text

    Move the indent over on the ruler for the To edit. Then add a couple lines in the from box (hit return between lines). THen click the button. THe First line copied in should be on the indent, but the remaining lines will appear on the left margin rather then indented.

    I have also tried:

    ToRichEdit.SelectionAsString := reFrom.asString;

    and

    ToRichEdit.InputString(reFrom.Text); //THis one ignores the indent on the ruler completely.

    The goal is to have all lines indented as set by the ruler in the poaragrpah where the text is inserted.

  • I have updated to 6.29 and still no luck. I need for the text to be inserted at the indent level of teh destination edit. The code is bringing the paragraph indentations of the source box. If it will always uuse the source indent, I may be able to manually store and then set the indent level.

    • Offizieller Beitrag

    Hi,

    The string you insert should be ANSI, not RTF. Otherwise it includes indents.

    I tested it here ok.

    If even InputString does not work there is something else going on. Maybe an Event which overwrites the attributes or a reload from the database.
    InputString Always must work since it is what happens when the user types. And there is no switching of the indent.