We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

GC: Undo/Redo

Thread ID:

Created:

Updated:

Platform:

Replies:

62730 Jun 20,2007 09:57 PM Jun 20,2007 11:26 PM Windows Forms 1
loading
Tags: GridControl
Richard Bysouth
Asked On June 20, 2007 09:57 PM

Hi

I'm in the process of migrating from a different grid to your GridControl. For the other grid control I had to write my own command classes to handle applying fonts/colours etc. to a selected range, and to provide my own undo/redo functionality.
I would like to use the built-in undo/redo but am not sure as to whether I need to create my own classes again, inheriting from GridModelCommand. I've looked at the UndoRedoSample and I think that works fine for me, but I need to be able to set the description for each type of command.

For example, if I set the font colour for a range of cells, I would like to display "Font Colour" in the undo list, rather than "Change Cells R5C2..." But how can I determine what was changed from the GridChangeCellsCommand?

hope that makes sense!

thanks

Richard

Richard Bysouth
Replied On June 20, 2007 11:26 PM

Actually, I've just answered this myself!

I just need to use a transaction for each command. This makes things so easy!

For example:

grid.CommandStack.BeginTrans("Font Color")

Dim cellInfo As New GridStyleInfo

cellInfo.TextColor = dlg.Color

'Apply the settings to the current selection
grid.ChangeCells(selectedRange, cellInfo)

grid.CommandStack.CommitTrans()

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;