ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

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.

https://github.com/unvell/ReoGrid/issues

#1 2016-08-28 12:29:43

danny
Member
Registered: 2016-05-05
Posts: 17

How to disable undo/redo

Hi,

Is it possible to disable the undo and redo feature in the grid?

For things like pasting I can handle the BeforePaste event and for pressing the delete key I can handle BeforeCellKeyDown and check if e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Delete, but I couldn't see how to do this for key combinations like Ctrl + Z.

Thanks.

Offline

#2 2016-09-13 15:53:21

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: How to disable undo/redo

Impossible to prevent undo/redo directly but there is other ways to do the same. For example you can prevent ReoGrid to perform any actions so that there will no actions can be undone by users.

Code to prevent specified type of action:

grid.BeforeActionPerform += Grid_BeforeActionPerform;

private void Grid_BeforeActionPerform(object sender, WorkbookActionEventArgs e)
{
	var bargs = (unvell.ReoGrid.Events.BeforeActionPerformEventArgs)e;

	// if action type is RemoveRangeData, cancel it
	if (bargs.Action is unvell.ReoGrid.Actions.RemoveRangeDataAction)
	{
		bargs.IsCancelled = true;
	}
}

What is your original requirement you want to prevent undo/redo? Maybe there is better way to do.

Offline

#3 2016-09-13 16:20:46

danny
Member
Registered: 2016-05-05
Posts: 17

Re: How to disable undo/redo

Thanks for the suggestion. I'll try it out. I'm struggling to convert this into VB code though. Specifically:

var bargs = (unvell.ReoGrid.Events.BeforeActionPerformEventArgs)e;

Thanks for your help.

Offline

Board footer

Powered by FluxBB