I have to figure out a way to allow toggling the protective flag. I'm close to a beginner in this document concept and almost lost in it.
Using D2009, with the latest brew of WPTools 6 (12.12.2012) I have modified the WPT2009Project1 so it contains a TWPRichText from start.
Code
wprtEditor.ProtectedTextAttr.BackgroundColor := clYellow;wprtEditor.ProtectedTextAttr.UseBackgroundColor := true;wprtEditor.ProtectedTextAttr.UseTextColor := false;wprtEditor.ProtectedProp := [ppParProtected, ppCheckAllText, ppProtected, ppAllowEditAtTextEnd, ppProtectSelectedTextToo];
Maybe I've added too many procetion properties? Maybe not relevant, this it the EditOptions:
Code
wprtEditor.EditOptions = [wpTableResizing, wpTableColumnResizing, wpObjectMoving, wpObjectResizingWidth, wpObjectResizingHeight, wpObjectResizingKeepRatio, wpObjectSelecting, wpObjectDeletion, wpSpreadsheetCursorMovement, wpActivateUndo, wpActivateUndoHotkey, wpActivateRedo, wpActivateRedoHotkey, wpMoveCPOnPageUpDown, wpAllowCreateTableInTable];
I try to use this snippet to toggle but all it does is setting the attribute. Undoing has never worked.
Code
if afsProtected in wprtEditor.CurrAttr.Style then
wprtEditor.CurrAttr.DeleteStyle([afsProtected])
else
wprtEditor.CurrAttr.AddStyle([afsProtected]);
What is the right procedure, please?
When in text surrounded by the \wpprot, I assume the DeleteStyle seeks in both ways for the attribute to remove. Are there navigational functions to seek start and end of a given attribute.