Multiple Undo/Redo

Discussion in 'Questions (Windows Mobile)' started by Rioven, May 12, 2008.

  1. Rioven

    Rioven Active Member Licensed User

    What are nice ways to implement multiple undo and redo on applications like
    text editor or table entries?
  2. Erel

    Erel Administrator Staff Member Licensed User

    The following code implements multiple Undo in a table.
    This code will not work if the value of a cell contains a comma.
    You can change it to work with some other character like tilde (~) instead.
    alStack is an ArrayList.
    Sub Globals
    'Declare the global variables here.
        Dim Type(Column,Row,Value) UndoItem
    End Sub

    Sub App_Start
    End Sub

    Sub FillTable
    "Col 1",50)
    "Col 2",50)
    "Col 3",50)
    For i = 1 To 10
    End Sub

    Sub AddItem (column,row,oldValue)
    0,column & "," & row & "," & oldValue)
    End Sub

    Sub UndoLast
    If alStack.Count = 0 Then Return 'No items
        UndoItem() = StrSplit(alStack.Item(0),",")
        Table1.Cell(UndoItem.Column,UndoItem.Row) = UndoItem.Value
    End Sub

    Sub btnChange_Click
        col = Table1.SelectedCol
        row = Table1.SelectedRow
    'Save the previous value
        Table1.Cell(col,row) = txtChange.Text
    End Sub
    Sub btnUndo_Click
    End Sub
  3. Rioven

    Rioven Active Member Licensed User

    Hi Erel, Thanks for this useful sample code for table.:)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice