General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Accessing the Undo Stack

  • scotth

    Accessing the Undo Stack

    Participants 4
    Replies 5
    Last Activity 11 years ago

    Using XMetaL 6.0, is there any way to access the undo and redo stacks? In particular, I am just wanting to know whether or not they contain anything, so that I can enable and disable these commands appropriately.

    Thanks,

    Scott

    Reply

    Derek Read

    Reply to: Accessing the Undo Stack

    You cannot obtain a list of actions that were done (I assume that is what you want). This would be a nice to have feature (and we've thought about it but it has not come the top of the list yet). We've thought it might be nice to assign names to everything a user could do and then expose that in a drop down or similar on the Undo/Redo buttons, which might also allow you to Undo/Redo multiple actions at once. If that work was done a corresponding API to expose that might be made. That would likely be trivial, but the main work would need to be done first, and that does not appear to be trivial.

    I'm not sure when it would be necessary to programmatically enable/disable the Undo/Redo commands. Can you describe in more detail, or give a usage example?

    Knowing this might help me push such a feature up the list a little bit if it sounds like a need others could benefit from. Or perhaps there are other ways to currently accomplish what you need to do by tackling it from a different angle.

    Reply

    scotth

    Reply to: Accessing the Undo Stack

    I was wanting to provide a little bit better context display for my undo and redo buttons, disabling undo when the undo stack was clear. If there's not an easy way to access the stack or a count of the stack items in the current version, then it's not a big deal.

    Reply

    Derek Read

    Reply to: Accessing the Undo Stack

    Why do you need to do this manually? The buttons should enable / disable on their own (unless you've found a bug, or I still don't understand the context).

    Reply

    scotth

    Reply to: Accessing the Undo Stack

    I probably should have been a bit clearer. I am developing a solution using XMAX, so you have to do these types of things on your own. The webmax demo simply enables or disables these buttons based upon whether a document is open.

    Reply

    Derek Read

    Reply to: Accessing the Undo Stack

    I would have to say that seems to be a hole in our APIs for XMAX. Basically, you need to be “optimistic” when designing your UI. In other words, enable the UI if ActiveDocument.Saved == false, or keep track of whether the user has saved in your part of the code. This probably also means making a decision as to whether you allow an “undo paste save” feature or not (in which case I suppose the enable/disable logic might be different or not doable, ie: always on).

    Some (probably pretty advanced) ChangedNodesList monitoring could possibly get better results, though I have not tried to do anything like this.

    Reply

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

Lost Your Password?

Products
Downloads
Support