General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Element no longer read-only after undo

  • lefrac01

    Element no longer read-only after undo

    Participants 4
    Replies 4
    Last Activity 2 days, 20 hours ago

    Given a read-only element, after the following code is run on it and the user presses undo, the element is not set back to read-only. I want to allow the user to delete an element with a button and be able to undo this action without losing the read-only protection.

    ActiveDocument.BeginMutations(“example”)
    rng.Select()
    rng.ReadOnlyContainer = False
    rng.NonRemovableContainer = False
    rng.SelectElement()
    rng.Select()
    ActiveDocument.DeleteSelection()
    ActiveDocument.EndMutations(True)

    Reply

    nhu1

    Reply to: Element no longer read-only after undo

    Hi,

    You still can delete an element with readonly content directly.

    The following 2 lines are not needed.

    rng.ReadOnlyContainer = False
    rng.NonRemovableContainer = False

    Regards,

    Ning

    Reply

    lefrac01

    Reply to: Element no longer read-only after undo

    Hello, thanks for the reply.

    The requirement is for the content and also the element itself to be readonly.

    Without both those lines the element is not deleted. If I leave only rng.NonRemovableContainer = False the element is deleted but is still editable after undo.

    It looks like the undo feature is re-adding the XML content but not reapplying the readonly state.

    Reply

    nhu1

    Reply to: Element no longer read-only after undo

    Hi,

    rng.ReadOnlyContainer = False
    rng.NonRemovableContainer = False

    The two lines about are not executed as commands. This is why they are not undoable.

    At present, there is no workaround it. I will add the issue to the backlog of XMetaL 16.

    Regards,

    Ning

    Reply

    rozysharma

    Reply to: Element no longer read-only after undo

    Another method is to restrict formatting and editing. Making your document a read-only file means that the document can be read or copied but not modified.doramas yt

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support