Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Undo/Redo in Diagram.LaneGrid (Read 1552 times)
David Long
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 125
Location: England
Joined: Oct 23rd, 2006
Undo/Redo in Diagram.LaneGrid
Dec 20th, 2017 at 3:32pm
Print Post  
I am using version 6.4.1. There does not seem to be support for Undo/Redo to changes in the LaneGrid, e.g. Adding/Removing rows and columns. Is this feature coming or do I do it the hard way!

DavidL
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: Undo/Redo in Diagram.LaneGrid
Reply #1 - Dec 20th, 2017 at 9:08pm
Print Post  
Sorry, the hard way -

Code
Select All
void OnDiagramAddRow(object sender, EventArgs e)
{
	diagram.ExecuteCommand(
		new AddGridRowCmd(diagram, "row"));
}

class AddGridRowCmd : Command
{
	public AddGridRowCmd(Diagram diagram, string title) : base("Add grid row")
	{
		this.diagram = diagram;
		this.title = title;
	}

	protected override void Execute(bool undoEnabled)
	{
		header = new Header(title);
		diagram.LaneGrid.RowHeaders.Add(header);
	}

	protected override void Undo()
	{
		diagram.LaneGrid.RowHeaders.Remove(header);
	}

	protected override void Redo()
	{
		diagram.LaneGrid.RowHeaders.Add(header);
	}

	Diagram diagram;
	string title;
	Header header;
} 



Regards,
Slavcho
  
Back to top
 
IP Logged
 
David Long
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 125
Location: England
Joined: Oct 23rd, 2006
Re: Undo/Redo in Diagram.LaneGrid
Reply #2 - Dec 23rd, 2017 at 9:39pm
Print Post  
OK, Thanks for your help. I will do similar classes for deleting rows/columns, changing row/column height/width etc...
Regards
David
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint