How to refresh WPRichText after a FoundAttr.IncludeStyle?

  • I'm trying to add some styles to the text using:

    With the content of the WPRichText as the following:

    01) MARIA ANTONIA JACYNTHO DOS SANTOS PICCAGLI, brasileira, viuva, do lar, portadora do RG/SSP/SP nº e do CPF nº , uma parte ideal equivalente a sessenta por cento (60%);

    The bold part is where I'm adding the underline style.

    When I run the code, I can see that the style is updated with the Underline option, but the screen is not updated unless I save it to the database and load again.

    I tried to refresh with .Refresh, .DelayedReformat and .ReformatAll but none of these seen to update the screen, what am I missing?

    PS: Using Delphi 2010 and WPtools 6.

    • Offizieller Beitrag

    Hi,

    Zitat

    When I run the code, I can see that the style is updated with the Underline option, but the screen is not updated unless I save it to the database and load again.

    I overlooked your post - this was not intentional. This is an old thing when using the DB sensitive control - I guess You are using this.

    You need to call "Changing" before and "ChangedText" after any change to the text done in your code.

    Julian

  • Hello, no problem

    But I'm not using the DBWPRichText, I'm using the regular WPRichText, then I load the text from database using WPRichText.AsString := Field[].AsString.

    I know the text is updated because if I place the cursor over the lines that should be underlined the ToolBar shows the underline button correctly, but the only way I can update the screen is: save the data to the dabase and load it again with WPRichText.AsString := Field[].AsString.

    What I want to do is refresh the WPRichText (on the screen) without have to save it to database, got it?

    I tried to call "Changing" before and "ChangedText" after the changes, but still doesnt work, in fact, theres no ChangedText property or procedure in WPRichText.

  • Zitat von wpsupport

    Use ReformatAll(true, true)

    As I said in the first post, I already tried ReformatAll(True,True), still doesnt update the screen.

    Here's the code:

  • I have to agree with Kym... I can't get the WPRichText to update either. In my case, when I toggle the numbered bullets to either restart or continue numbering, the numbering sequence does not update until I save and reload the WPRichText. With or without the ReformatAll and/or a Refresh. What I had to do is this (snippet):

    Eric
    (WPTools5, but sounds like it is in WPTools6 as well)

    • Offizieller Beitrag

    I thought very long about this.

    I also created an example with a TWPRichText and 2 buttons. This is the code:

    For both button actions the screen is updated correctly and at once.

    Button2 does not need "Initialize" since it does not change the character attributes (i.e. "bold") with low level API like Button1 does.

    Julian

  • As I've mentioned in a similar post in WPTools5, I've emailed you a sample app showing the problem (even your example fails for me). Perhaps it's a version issue since I am still on 5.54. I sent both a compile version and the source so you can compare.

    • Offizieller Beitrag

    Hi,

    I tested your demo and the code

    Is sufficient to update the screen on its own. The other actions, ReformatAll, Reload do not change the display at all.

    Julian