Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

[358] Multiple Undo/Redo

Last post 05-03-2002 6:31 PM by kumbach. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [358] Multiple Undo/Redo

    This thread is for discussions of Multiple Undo/Redo.

    • Post Points: 0
  • 02-14-2002 7:20 PM In reply to

    Two Bug Fixes

    This is very useful code.  Thanks.  I fixed what seem to me to be a couple of bugs.

    Bug 1

    If the Delete key is used to delete the next character, status will not get updated.

    Fix For Bug 1

    In Code:
    RichTextBox1_KeyDown
    , after

           Code:
    .ModifyType = urDeleteText
           AddToUndoStack cUndo


    I added

           Code:
    UpdateStatus


    This is necessary because, if you just delete the next character, you have not changed the selection start point or the selection length (0), so Code:
    RichTextBox1_SelChange
    , which includes a call of Code:
    UpdateStatus
    , will not get triggered.

    Bug 2

    After a redo followed by an undo, the redo could not be done again.

    Maybe this is supposed to be a feature rather than a bug, but I think it is a bug:  that is not how Microsoft Word or the VB6 editor behave, and I do not want it to happen in my program.

    Fix For Bug 2

    Delete the following code.

    Code:
    Private Sub RichTextBox1_Change()
    If bRedoing Then
       bRedoing = False
       ClearStack RedoStack
    End If
    End Sub

    • Post Points: 0
  • 05-03-2002 6:31 PM In reply to

    • kumbach
    • Not Ranked
    • Joined on 05-03-2002
    • New Member
    • Points 5

    Bug fix for tab key

    This code is excellent. Most people should find it simple to understand and very easy to integrate with an application.

    Found one bug. If you highlight a block of text, then press the TAB key, the text is properly replaced. However, you can't undo the action. This bug can be fixed as follows:

    In rtDoc_KeyPress(KeyAscii As Integer)

    Change this line:

       ElseIf KeyAscii >= 32 Or KeyAscii = 13 Then

    To this:
       
       ElseIf KeyAscii >= 32 Or KeyAscii = 13 Or KeyAscii = vbKeyTab Then

    • Post Points: 0
Page 1 of 1 (3 items)