Undo/Redo

Dear,

We have the facility to Show/Hide the list group in Graph Node.

Graph Node appears like below:

when we hide list group in grpah node, appears like below:

When We have provide facility Undo/Redo.

Problem occured in this condition:

  1. First Hide the List group in graph node.
  2. Now Perform undo operation.
  3. now perform hide the list group ,then list group is not hide.
    graph node appears like below :

Write code for Undo (Which are below):

GraphLayout gLayout = this.GetLayout;
if (gLayout != null)
if (gLayout.GetView.GetDocument.CanUndo())
gLayout.GetView.GetDocument.Undo();

Write code for Redo (Which are below):

GraphLayout gLayout = this.GetLayout;
if (gLayout != null)
if (gLayout.GetView.GetDocument.CanRedo())
gLayout.GetView.GetDocument.Redo();

Problem occured ,when we have perform undo/redo .

sudhanshu

Have you check your placement of StartTransaction and FinishTransaction calls?

yes

Sir,

One more thing

what is the meanning of this code,(this code in your sample(FlowCharter2/GrpahNode.cs)

public override void ChangeValue(GoChangedEventArgs e, bool undo) {
if (e.SubHint == ChangedKind)
myKind = (GraphNodeKind)e.GetInt(undo);
else
base.ChangeValue(e, undo);
}

public const int ChangedKind = GoObject.LastChangedHint + 7;

Whenever you add a property to a custom node, you have to manage the changes to it correctly so that it ties into our Undo / Redo support.

It's not too hard if you follow the simple steps...
GraphNode defines a property called "Kind", which is the kind of flowchart symbol the node is. That property is managed by the code:
[code]
public GraphNodeKind Kind {
get { return myKind; }
set {
GraphNodeKind old = myKind;
if (old != value) {
myKind = value;
Changed(ChangedKind, (int)old, null, NullRect, (int)value, null, NullRect);
OnKindChanged(old, value);
}
}
}
[/code]
Chapter 4 of the User Guide, the section on GoObject talks about Event Handling, and changes to objects.
Chapter 7 is on Implementing Undo and Redo in your app. All this stuff just works if you use our predefined nodes, but if you venture off into designing custom nodes, there isn't any way around not understanding this stuff. Chapter 7 talks about the ChangeValue method.

Dear,

We have Changed Graph Node Text Value through property grid,

and perform undo opertion, then previous text value of graph node display

but do not show previous Text value of graph node in Property grid.

Regards

sudhanshu

Do you have code in OnDocumentChanged to update it? (See what Demo1 does in GraphView.)

yes,we see code on Document Changed in GraphView(Demo1).

This type of Problem also occurs,when changes apply through
Layout Setting.

regards
sudhanshu

PropertyGrid is a .NET control, and isn’t directly integrated into GoDiagram. That integration has to be supplied by the application.

From the PropertyGrid documentation:
The information displayed in the grid is a snapshot of the properties at the time the object is assigned. If a property value of the object specified by the is SelectedObject changed in code at run time, the new value is not displayed until an action is taken in the grid that causes the grid to refresh.