twpRichText - Detecting any change as it happens

  • Using v5.23.6.

    I know I can tell when the contents of the twpRichText has been modified by checking the modified property.

    BUT how do I detect a change as it happens so I can update the enabled status of a save / cancel button?

    I had the type of question in the past related to using spell check and we had a work around using an event of the icon press of the spell check button.

    BUT... no one is clicking a button here... just typing text.

    I would think the OnChange event would be the natural thing, but no go.

    1) So what is the OnChange good for?

    2) How do I detect any changes to the content by the user.

    3) How do I detect any changes to the content when done by code and not the user.

    Again... not intersted in the modified property... but a way to have an event fire as it happened.

    • Offizieller Beitrag

    My version of the WPCtrMemo does this:

    Zitat

    procedure TWPCustomRtfEdit.ChangeApplied;
    begin
    Modified := TRUE;
    if assigned(FOnChange) then FOnChange(Self);
    end;

    ChangeApplied is called after a change has made to the text.

    v5.23.6 is a bit old version, there is a much newer in your download account.

  • Zitat von wpsupport

    My version of the WPCtrMemo does this:


    ChangeApplied is called after a change has made to the text.

    v5.23.6 is a bit old version, there is a much newer in your download account.

    Ok... here was the problem in this situation. We had always used the TDBWPRichText which wasn't firing the onChange. I just switched everything over to the TWPRichText and now I see it firing. My WPCtrMemo has the same code.

    I am definitely going to like using the TWPRichText since the OnChange works. We will be abandoning the TDBWPRichText since we are always using a SQL database and usually with a middle tier.