« Characters Not Embedding With Flex DefineFont4Text Layout Framework Follow Up and Request »

3 comments

  1. § RDermer Email said on :
    Another possibility is to implement IUndoManager yourself and supply that impl to the EditManager constructor. Your IUndoManager would then called directly by TLF and can add TLF operations into a mixed undo stack.

    That's how we intended it to work.
  2. § Richard Leggett® Email said on :
    Thanks for that Richard, I hadn't considered that I could slot another IUndoManager in (I guess I still have to work with TLF a lot more before I'm familiar with all the interfaces/classes.)

    That would provide us a with way of using an intermediary IUndoManager to wrap TLF's Operations into Commands that the mixed undo-stack can work with, in that case I think I'd still end up with an ApplyFlowOperationCommand so it ends a up fairly similar solution, but perhaps that's a cleaner route overall.
  3. § Richard Leggett® Email said on :
    In the example code I'm executing the FlowOperation (stored in the Notification body) via the EditManager. You *must* execute any TextFlow operations (formatting or otherwise) via the EditManager to preserve undo inside the Text Layout Framework.

    However, I didn't actually need to apply the FlowOperation inside my undoable Command itself...

    In fact now I use the EditManager directly in my application... anything from simply editManager.applyFormat(...) calls, to editManager.begin/endCompositeOperation() for complex groups of operations that I want to treat as 1 single edit.

    I then listen for FlowOperationEvents which are dispatched each time you use the EditManager on the TextFlow. When I hear these, I simply dispatch an event to execute my ApplyFlowOperationCommand via PureMVC, which stores the FlowOperation in the notification body (as per this code), but the difference this time is the command has nothing inside its execute method because the EditManager has already performed the action. But the undo() method remains the same.

    Two ways to skin this cat, but I found this second method to be easier to read as your EditManager operations all take place in situ.

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
Contact. ©2010 by Richard Leggett. blog tool / UK web hosting / evoTeam.
Design & icons by N.Design Studio. Skin by Tender Feelings / SkinFaktory.