Undo is not working properly

Hi,

I am using registered version of GODiagram.

I am using SubGraph node and GraphNode.

Once after adding those items if you undo it is behaving strange.

I attached simple pictures explains my problem below.

Also attaching vb.net source code so you can duplicate the problem.

Please can you suggest me what i am doing wrong.

Please download source code from
<span =“Apple-style-span” style="font-family: arial; line-height: normal; font-size: small; ">

<span =“Apple-style-span” style="font-family: arial; line-height: normal; font-size: small; ">http://www.largedocument.com/1/2b110639/PLASMA.zip
<span =“Apple-style-span” style="font-family: arial; line-height: normal; font-size: small; ">

<span =“Apple-style-span” style="font-family: arial; line-height: normal; font-size: small; ">Thanks & Regards,
<span =“Apple-style-span” style="font-family: arial; line-height: normal; font-size: small; ">

<span =“Apple-style-span” style="font-family: arial; line-height: normal; font-size: small; ">Venkatesh
<span =“Apple-style-span” style="font-family: arial; line-height: normal; font-size: small; ">

well, your add subgraph code does this:

StartTransaction()
SkipsUndoManager = true

which doesn’t look good. Typically you only touch SkipsUndoManager if you are making some transient visual change to a GoObject (like highlighting a port on a mouse over).

so… read through the Undo/Redo section of the User Guide. Then look through some of the samples to see how they use Start/Finish Transactions and implement ChangeValue when required.

Hello Jake,

Thanks for quick reply. Now i have removed SkipUndoManager=True

Works much better than before, however still got one more issue.

Once after adding subGraph then expand and add node to it.

Then if i do undo it is behaving not correct.

Adding node and undo i want to just remove node and keep subgraph opened.

Next undo subgraph should close etc…

Please download modified code from
http://www.largedocument.com/1/778ae626/PLASMA1.zip

Here attaching screen shot for the error

Please can you look into my code and suggest me to fix this error.

Thanks again for your help.

Regards,

venkatesh

It’s probably going to be Monday… my kids have soccer, volleyball and baseball this weekend.

Make sure you’re doing the Start/Finish around each “transaction”.

Hello Jake,

That is not a problem. Have a nice weekend.

Wait for your reply till monday.

Thanks & Regards,

Venkatesh

Hello Jake,

Did you had a chance to look at my code?

Please let me know where i am doing wrong.

Regards,

Venkatesh

Sorry, caught a cold over the weekend. will look at it today.

still looking. One thing I see, not related to undo:

in GraphNode.DoMove, you use CurrentSubGraphNode, and I think you really want the node’s parent subgraph. I’m not sure how you track CurrentSubGraphNode, but that looks a little funky.

You don’t handle Changed for GraphNode.mySide (or any of the Public Property bits you declare).

You don’t handled Changed for LimitingSubGraph AddedPort.

I don’t know if fixing those things is going to clear it all up, but that’s a place to start.

add the second line to your code:

  doc.UndoManager = New GoUndoManager()
  doc.UndoManager.ChecksTransactionLevel = True  ' new

and watch for Trace messages that show out of place updates (those not done under a transaction)

Dear Jake,

I have added <span =“Apple-style-span” style=": rgb248, 248, 252; ">doc.UndoManager.ChecksTransactionLevel = True line.

Also Added changed event for GraphNode
<span =“Apple-style-span” style="font-family: ‘Courier New’; font-size: 13px; line-height: 18px; white-space: pre; : rgb255, 255, 255; "> Public Overrides Sub Changed(ByVal subhint As Integer, ByVal oldI As Integer, ByVal oldVal As Object, ByVal oldRect As System.Drawing.RectangleF, ByVal newI As Integer, ByVal newVal As Object, ByVal newRect As System.Drawing.RectangleF)

            MyBase.Changed(subhint, oldI, oldVal, oldRect, newI, newVal, newRect)
 
        End Sub
And already Changed event was there for LimitingSubgraph
Please let me know what you mean not handled for AddedPort.
When i debug the last event happes was ChangedBounds which is correct.
before that event it was going into OnLayerChanged event.
When i Undo first it is just doing changebounds trasaction.
After that it is not going into any trascation it is ignored.
Please suggest me where i am doing wrong.
Best regards,
Venkatesh
<span =“Apple-style-span” style="font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; "> 

Dear Jake,

Another thing i noticed is if add GraphNode to Document instead of SubGraph, Undo is working.

Please download updated code
http://www.largedocument.com/1/b4a22bae/Plasma2.zip

But i need to add GraphNode to Subgraph only not to document.

Can you suggest more ideas or where i am doing wrong when i add to subgraph.

Thanks again for your help.

Venkatesh

Dear Jake,

Sorry to disturb to again.
Did you had a chance to look further into my code?

Thanks & Regards,

Venkatesh

Sorry, it’s been a busy week here. I will try to get to it today.

It’s telling me that the largedocument.com zip file is missing.

Hello Jake,

Sorry for file missing from hosting site.

I uploaded again.

http://www.4shared.com/file/KOE0Hj-m/PLASMA2.html

Thanks & Regards,

Venkatesh

Hello Jake,

https://share.mycontent.orange.co.uk/n/50-2/share/LNK79304e73b42002ffb/

Please use above link for download if you are not downloaded already.

Regards,

Venkatesh

Looking at this now.

Your LimitingSubGraph method: Public Overrides Sub ChangeValue(ByVal e As Northwoods.Go.GoChangedEventArgs, ByVal undo As Boolean)

does not call base.ChangeValue.

So, things can’t be undone.

The whole isInitializing flag looks a odd anyway, I’m not sure what you were trying to accomplish with that. I just commented out your whole ChangeValue method and it seems to work fine.

Hello Jake,

I could not believe as simple and obvious of calling base is fixed.

I spent so at least month to fix this and could not figured it out.

Thanks very much for looking into my code and helping me.

Problem is fixed now.

Best Regards,

Venkatesh