TWPPagePropDlg Side Effects

  • Hi,

    We are using WPTools version 5.30.1 and we encounter some side effects with the TWPPagePropDlg. When we open the dialog, the OnChange event is fired on the Editor even if the user does not make any changes on the page layout (just hits the OK button, Cancel button, or the X button to close the dialog). This triggers our code to take some actions which should not happen if there is no change in the editor. Is there a way to fix this behavior?

    Thanks,

  • Hi,

    Can you provide more details about how to do it? Even better, can you incorporate this change in the next WPTools version, so that we don't need to maintain the WPTools source code ourselves?

    Thanks,

  • We are now using v5.40. It appears you have implemented a fix that eliminates the firing of the OnChange event when no change is made to the TWPPagePropDlg.

    But now, our system does not save changes that we do make to the TWPPagePropDlg, so that the document would use the updated settings upon future openings.

    I do not see any properties, methods , or events that we can access from our code that would force the saving of these updated settings. Do we have to modifiy the WPTools code to persist the dialog changes? I would rather not be making modifications to your code if it is not necessary.

  • After implementing code similar to what you recommended on Nov 24, 2008, our program was working using WPTools 5.40. If we did not actually make any changes, our "changes were made" message dialog did not get displayed. This was true whether we clicked the OK button, Cancel button, or the X button to close the TWPPagePropDlg (GOOD). I installed version 5.47.5, and our program is again displaying our "changes were made" message when no changes have been made. But now it only occurs after the OK button is clicked.

    It appears that this newer version once again fires the OnChange event, which was not firing in 5.40. The OnChange event is making WPRichText.Modified := true and causes our message dialog to be displayed.

    Was this change accidental, or was it on purpose?

    How do you suggest we proceed?

  • Here is some more information about our problem. On Nov 24, 2008, your suggested code was

    Zitat

    if WPPagePropDlg.Execute.Execute then
    WPRichText.Modified := true;

    If I compiled WPPagePropDlg.Execute.Execute, I got an error.

    Therefore, I used

    Zitat

    if WPPagePropDlg.Execute then

    in my code with version 5.40 when it was working. This statement has not changed in our code.

    Was your original suggested fragment a mistake? Or should it compile with

    Zitat

    .Execute.Execute

    ?

  • Julian,

    Upon further examination of your code, it appears that the reason our code broke is the change you made to the TWPPageProp.btnOKClick event.

    You added a try-finally, and are now calling ChangeApplied. The ChangeApplied in the finally block is invoking the OnChange event. Since version 5.40 was not calling ChangeApplied, the OnChange event did not get run when the TWPPageProp was viewed but not edited. Now the OnChange event is getting fired when the TWPPageProp is only viewed.