MultipleRedoControl

12 posts, 0 answers
  1. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 11 Apr 2012 Link to this post

    I am using the MultipleUndoControl; is there a MultipleRedoControl? Or is there a way to use the MultipleUndoControl with Redo?
  2. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 11 Apr 2012 Link to this post

    Upon further investigation, apparently there is NO redo support beyond the single redo command.  What was the thinking in developing multiple undo without developing the redo counterpart.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Kammen
    Admin
    Kammen avatar
    312 posts

    Posted 12 Apr 2012 Link to this post

    Hi Steve,

    We do not have a multiple redo control because most feature requests we get are for functionality that MS Word offers. As you may notice, there is no multiple redo control in MS Word either.

    However, if it is a requirement of your project, you can create your own custom multiple redo control. All you should do is to create your own custom command that inherits from RichTextBoxCommandBase. Then, pass the number of redoes that you want to perform as a command parameter, and in ExecuteOverride method call:

    int undoStackIndex = Convert.ToInt32(parameter);
    for (int i = 0; i <= undoStackIndex; i++)
    {
        this.AssociatedRichTextBox.Undo();
    }

    Then you must create your own control and implement the logic the way you would like it to work. 

    If you have a license for RadControls for WPF, you can download the source of the controls and take a look at the MultipleUndoCommand and MultipleUndoControl for reference. 

    Hope this answer your question.

    Greetings,

    Kammen
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 12 Apr 2012 Link to this post

    You know, I rarely use Word, and didn't realize it suffers from the same deficiency.  I, of course use VS 2010 which has both multi-undo and multi-redo, so I assumed this was a standard implementation.  I appreciate your direction on how to create my own!
    Best and thank you,
    Steve
  6. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 12 Apr 2012 Link to this post

    It looks like the only way to access the redoStack of the DocumentHistory class will be through reflection. There is no GetLastRedoCommands method. Do you know of any othere way?Thanks in advance,
    Steve
  7. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 17 Apr 2012 Link to this post

    Hi Steve,
    You don't actually need to access DocumentHistory class - instead you can just call the RadRichTextBox.Redo method as many times as you need it:
    int redoAcationCount = 4;
    for (int i = 0; i < redoAcationCount; i++)
    {
        this.radRichTextBox1.Redo();
    }

    If you have further questions do not hesitate to contact us again.

    All the best,
    Mihail
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 17 Apr 2012 Link to this post

    How else can I get a list of the actions to display in the drop down?  Other limitations include...

    Each time a character is typed, it counts as one undo or redo Typing action.  With a limit of 20 actions each time the drop down is displayed, this is not a very good implementation.  Just to undo the typing of the first sentence in this message would require 4 drop downs (60+ characters).  Typing actions in Word are grouped together.

    Rather than considering backspaces as Typing as it does in Word, each backspace is considered a separate Delete action.

    So much of the Undo/Redo mechanism is private or internal.  The only way I can see to modify the behavior to mimic that of Word, is to use reflection, clearly violating the spirit of OOD.

    Since in your original response, you indicated that the intent was to provide the same functionality as Word, are there plans to enhance the undo/redo architecture to match that of Word?

    Thanks,
    Steve
  9. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 19 Apr 2012 Link to this post

    Hello Steve,

    Unfortunately there isn't any other way for you to implement multiple redo.
    Regarding your question whether we planned to enhance this functionality, the answer is yes, we planned to implement the so-called smart undo which includes grouping of some commands of similar type. However, this task is not an easy one and has not been scheduled yet. I have created a PITS issue, which you can use to track our development plans:  http://www.telerik.com/support/pits.aspx#/public/silverlight/10790 

    About the limitation of how much actions you can revert, this will depend on the performance of the commands contained in those actions.

    Kind regards,
    Mihail
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  10. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 19 Apr 2012 Link to this post

    Hi Mihail,
     Although I had to use quite a bit of reflection, it really wasn't that hard to implement and I was able to handle the multiple redo and grouping of the Typing actions.  If you're interested, or anyone else is interested, I provided the source in the Code Library in the General and Integration Section under the title -

    RadRichTextBox Multiple Undo/Redo

    Thanks again for your responses,
    Steve
  11. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 23 Apr 2012 Link to this post

    Hello Steve,

    Thank you for sharing your work with us.
    We will review your code and will implement or modify it to fit our needs.

    If you have other questions do not hesitate to contact us again.

    Regards,
    Mihail
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  12. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 22 Feb 2013 Link to this post

    Hello again,

    Apparently the Undo/Redo implementation has been completely refactored in the Q1 2013 release.  Classes that I made use of...

     

    •     HistoryAction
    •     HistoryCommandAction

     

    have been removed breaking my current implementation of MultiRedo (see my previous post indicating that I posted the code in the Code Library).  I have searched all over for documentation on the new..

     

    • Undo/Redo Command grouping (assemble custom undo-redo actions) 

    feature.  Could you provide or direct me to documentation on this new feature, and suggest a way I can refactor my own code to work with the Q1 2013 release?

    Thanks in advance,
    Steve

  13. Boby
    Admin
    Boby avatar
    595 posts

    Posted 25 Feb 2013 Link to this post

    Hello Steve,
    We refactored the internal commanding mechanism, which allowed us to expose some additional methods through the IDocumentEditor interface, enabling grouping of the execution of the IDocumentEditor's methods in undoable commands, for example:
    // RadRichTextBox itself implements IDocumentEditor
    IDocumentEditor documentEditor = this.radRichTextBox;
      
    // You can also use RadDocumentEditor class, initializing it with any document;
    //IDocumentEditor documentEditor = new RadDocumentEditor(this.radRichTextBox.Document);
      
    documentEditor.BeginUndoGroup();
      
    documentEditor.InsertTableRow();
    documentEditor.InsertTableRow();
    documentEditor.InsertTableRow();
      
    documentEditor.EndUndoGroup("Insert 3 table rows");
      
    // You can also cancel the execution of the undo group, and it won't be recored in the history.
    //documentEditor.CancelUndoGroup();


    All the best,
    Boby
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready