You are not logged in.
This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.
I would like to know, how can track the undo and redo action, so i can update toolbar buttons?
Thank you
Shane
Last edited by asparatu (2014-12-31 00:47:57)
Offline
The following two methods are used to check whether or not there are any actions in stack:
grid.CanUndo()
grid.CanRedo()
And for monitor the actions performing, undoing and redoing, the following three events can be used to do that:
AddHandler grid.ActionPerformed, Sub(s, args)
MsgBox("Action Performed")
End Sub
AddHandler grid.Undid, Sub(s, args)
MsgBox("Undid")
End Sub
AddHandler grid.Redid, Sub(s, args)
MsgBox("Redid")
End Sub
Last edited by Jingwood (2014-12-31 00:51:56)
Offline
Hello Jing,
Thank you.. I was editing my question as you were answering it.. hehe
Shane
Offline
Jing,
Can that tell me if there is any items left in the stack? so, i can disable or enable the buttons?
Shane
Edit: You answered it already..hehe
Last edited by asparatu (2014-12-31 00:55:08)
Offline
I've just updated my answer for check actions:)
You asked a nice question, I think there should be a document to describe how to use actions in ReoGrid.
Last edited by Jingwood (2014-12-31 00:54:57)
Offline
Thank you..
I also seen that is on the worksheet .cancopy, .canpaste, .cancut also.. would that be use in the same way?
Shane
Offline
Yes, it's same usage. I use them in ReoGridEditor.
Offline
Jing,
Would this work
ddHandler rgMainControlContainer.Undid, Sub(s, args)
If rgMainControlContainer.CanUndo = True Then
tbbUndo.Enabled = True
Else
tbbUndo.Enabled = False
End If
End Sub
or would this be better
AddHandler rgMainControlContainer.Undid, Sub(s, args)
tbbUndo.Enabled = rgMainControlContainer.CanUndo()
End Sub
this the code for the Function for the undo and redo
As you can see i am checking to see if the grid is active control and doing undo and redo base on that..but i didnt have way to update the buttons, It work fine with short cut keys.
Private Function Undo() As Boolean
Undo = False
If rgMainControlContainer.Name = Me.ActiveControl.Name Then
rgMainControlContainer.Undo()
Undo = True
Else
frmUndoRedoManager.Undo()
Undo = True
End If
End Function
Private Function Redo() As Boolean
Redo = False
If rgMainControlContainer.Name = Me.ActiveControl.Name Then
rgMainControlContainer.Redo()
Redo = True
Else
frmUndoRedoManager.Redo()
Redo = True
End If
End Function
Last edited by asparatu (2014-12-31 01:14:02)
Offline
As you can see i am checking to see if the grid is active control and doing undo and redo base on that..but i didnt have way to update the buttons
Maybe you could use this:
AddHandler grid.LostFocus, Sub(s, args) Button1.Enabled = False
AddHandler grid.GotFocus, Sub(s, args) Button1.Enabled = True
Offline