Page Index Toggle Pages: 1 ... 3 4 [5] 6  Send TopicPrint
Very Hot Topic (More than 25 Replies) Undo and groups (Read 58839 times)
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo and groups
Reply #60 - Dec 1st, 2005 at 8:53am
Print Post  
Regarding the Z order - can you try making the composite command a bit more local, so it doesn't span many events. E.g. when BoxCreating is raised, set e.Confirm = false so that the drawing started by user is ignored. Get the coordinates of the box that the user has drawn, and call the method used to create the whole group programmatically so it is created at the same position where the box was drawn.
  
Back to top
 
IP Logged
 
rusted
YaBB Newbies
*
Offline



Posts: 42
Joined: Nov 3rd, 2005
Re: Undo and groups
Reply #61 - Dec 1st, 2005 at 9:35am
Print Post  
Yea I tried that ... still same problem.

As to 'display form', that just means that (1) is done in the windows form load, and (2) means the form is now shown to the user, and everything after that is responding to events in the form controls...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo and groups
Reply #62 - Dec 1st, 2005 at 11:33am
Print Post  
I've copied the code from the Add button to the Load method. The group is created when the application loads, the ActionRecorded is raised for the creation. Then I delete the group and get the ActionRecorded for the delete command too...

Is there anything else done in the FormLoad event handler that might affect the undo/redo operations ? By the way, while there is a composite command active, any new commands are added to it and no events are raised.
  
Back to top
 
IP Logged
 
rusted
YaBB Newbies
*
Offline



Posts: 42
Joined: Nov 3rd, 2005
Re: Undo and groups
Reply #63 - Dec 2nd, 2005 at 1:14pm
Print Post  
A number of things:

1.  I have created a composite command with a specific custom title to programatically delete a box which is the main object in a group.  If I then do an Undo and check all the titles in the ActionUndone event, the specific custom title for the composite command I used to delete is never encountered in the ActionUndone event handler ... ???

2.  I have created a flowchart with 5 boxes, and created 4 arrows connecting the boxes, yet when I look at the flowchart.arrows collection, there are 10 arrows in the collection, with arrows having duplicate origin and destination nodes ... ???  ... does an arrow get created somehow for all the subordinate boxes too?

3.  I have created a small test app to attempt to demonstrate the issue I am still having with Undo/Redo, but my cut down version does not display the same symptoms.  Is there any other advice you can suggest to try and track down this problem?

I must admit that if I hadn't already spent as much time as I have in implementing your control, I would now be at the point where I would be looking at other products, as this feels like beating my head against a wall - at some point I am going to relaise that it hurts and stop!  You have been very helpful but my problem persists.

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo and groups
Reply #64 - Dec 2nd, 2005 at 2:05pm
Print Post  
Regarding 1, I can imagine that happening if there is some composite command already active, i.e. not yet executed. Then the second command that has a custom title will be added as a subcommand to the first one, and you will not get ActionRecorded/Undone/Redone events for it but for the outer composite command.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo and groups
Reply #65 - Dec 2nd, 2005 at 2:16pm
Print Post  
Then 2 could happen too after undo/redo if some command is not added to the undo history, but other commands rely on its result. I don't know how exactly that could happen. What we can do is send you a debug build of the dll, you rebuild your application with that dll and send us the .exe file so the developers trace through the flowchart's undo/redo code.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo and groups
Reply #66 - Dec 2nd, 2005 at 2:21pm
Print Post  
Re 1 again, a not-executed composite command could explain a point from a previous post - why ActionRecorded is not raised. It won't be raised until the composite command is executed, because all other commands are added to it as subcommands until calling the composite''s Execute.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo and groups
Reply #67 - Dec 2nd, 2005 at 3:03pm
Print Post  
Or if you send us your project source I will get a developer here look through the code for what might go wrong. We can sign an NDA if needed.
  
Back to top
 
IP Logged
 
rusted
YaBB Newbies
*
Offline



Posts: 42
Joined: Nov 3rd, 2005
Re: Undo and groups
Reply #68 - Dec 2nd, 2005 at 3:47pm
Print Post  
How do I check if there is a composite command already active?

I have put a breakpoint where I create the composite command to delete the box, and at that point the UndoManager.History.Commands count = 0 - does that mean no composite commands are active at that point?

Another unexpected issue - when I execute the composite command that handles my box delete, I get an ActionRecorded with a custom command title of a composite command I created and executed in the form load event with UndoEnabled = False ??? How the hell does that command get recorded when I am doing a completely seperate command later on, and UndoEnabled is false ???



  
Back to top
 
IP Logged
 
rusted
YaBB Newbies
*
Offline



Posts: 42
Joined: Nov 3rd, 2005
Re: Undo and groups
Reply #69 - Dec 2nd, 2005 at 3:52pm
Print Post  
Your UndoManager is also not recording and re-applying the visibility of the subordinate boxes attached to the group.  Based on some user configurable options, certain of the subordinate boxes are either visible or not.  If I delete a box which has some of the subordinate boxes Visible = False, when I undo the delete, they re-appear with Visible = True.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo and groups
Reply #70 - Dec 2nd, 2005 at 4:06pm
Print Post  
I have looked at the undo code, it goes like this:

- if you create a composite command, it is stored in an UndoManager field as the current composite
- at this time the composite command is not yet in the undo history queue so History.Commands.Count can be 0
- new commands are not stored in the history queue while there is a composite command active, i.e. the UndoManager.currentCompositeCmd is set to a command instance. New commands are added as subcommands of that instance
- when the composite command Execute method is executed, it is added to the undo queue, and ActionRecorded is raised for just that composite command
- if UndoEnabled == false, a composite command might still be the active composite command in the undo manager and its ActionRecorded raised for it later when undo is enabled again

You could try not using composite commands when undo is disabled, I guess there is not much use of them if they won't be undone.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo and groups
Reply #71 - Dec 2nd, 2005 at 4:40pm
Print Post  
yes, it seems the groups Visible property somehow overrides the attached items' Visible when undoing/redoing.
  
Back to top
 
IP Logged
 
rusted
YaBB Newbies
*
Offline



Posts: 42
Joined: Nov 3rd, 2005
Re: Undo and groups
Reply #72 - Dec 2nd, 2005 at 6:10pm
Print Post  
OK, I have changed my code to NOT use composite commands when undo is not required, and this seems to have made a difference.  I guess the question is ... Does the CompositeCommand.Execute UndoEnabled parameter not work then?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo and groups
Reply #73 - Dec 2nd, 2005 at 6:31pm
Print Post  
I will have to check that with the developers tomorrow, it's a bit strange. There seem to be two Execute methods in CompositeCmd:

public void Execute();

and

public override void Execute(bool undoEnabled);

The first one should be called to close the current composite command and add it to the history queue. The second one is is used internally by the UndoManager and probably should not be called from outside. It seems that is implementation of the base Command class Execute(bool) method, which all commands should implement. I don't know why it's public though, it probably could be 'protected'.
  
Back to top
 
IP Logged
 
rusted
YaBB Newbies
*
Offline



Posts: 42
Joined: Nov 3rd, 2005
Re: Undo and groups
Reply #74 - Dec 6th, 2005 at 5:50am
Print Post  
There appears to be another issue and that is to do with arrows.

I create a flowchart and draw four boxes which are each given a new GUID as a tag.  I then draw 3 connecting arrows.  When I enumerate through the flowchart.Arrows collection, there are 19 (!!!!) arrows in the collection, not 3 ???  If I check the arrow.Origin.Tag and Arrow.Destrination.Tag, the same arrow is repeated up to 4 times.

Any ideas??
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 ... 3 4 [5] 6 
Send TopicPrint