rich text box issue

Discussion in 'ASP .Net' started by Catherine Jones, Dec 11, 2003.

  1. I have one more issue, please help me to find the solution ,
    My question as follows..

    In the rich text box, after an undo or redo operation how can we get
    information on the following things..
    1) which operation has happened(paste, insert or overwrite)
    2) Which line numbers are affected by the undo/redo operation
    3) How can we get the newly inserted text.

    Looking forward for your reply..
    Warm Regards
    Catherine Jones, Dec 11, 2003
    1. Advertisements

  2. The .UndoActionName and .RedoActionName properties should help you with step
    1. They will identify which operation _will_ occur if an undo or redo
    operation is made. You'd have to monitor these properties, so if the
    UndoActionName is "paste" (or whatever value it actually is) and the user
    then selects undo, you'd know that a paste was undone.

    For steps 2 and 3, you could write an algorithm to compare the old text to
    the new text. To identify where the change occurred in the document, you
    could use something like the following pseudocode:

    For i = 0 to LengthOfDocument
    If OldDocument.Character(i) <> NewDocument.Character(i) then
    StartOfChange = i
    Exit For
    End If
    Next i

    For j = LengthOfDocument to 0 Step -1
    If OldDocument.Character(j) <> NewDocument.Character(j) then
    EndOfChange = i
    Exit For
    End If
    Next j

    Hope this helps,
    Robert Jacobson
    Robert Jacobson, Dec 11, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.