Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Undo doesn't set dirty flag (Read 3109 times)
Necroman
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 49
Joined: Jul 27th, 2009
Undo doesn't set dirty flag
Sep 14th, 2009 at 1:22pm
Print Post  
When using UndoManager on Diagram, using Undo and Redo calls doesn't set the dirty flag from false to true.
I suppose using these methods is 'changing' of Diagram and therefore it should set the Dirty flag.
I haven't also found any switch of kind "disableUndoDirtyNotification", so is this bug or feature Smiley?
It's not a problem for me to emulate dirty setting on Undo/Redo manually.

Note: I'm resetting the dirty flag to false manually, because I don't use built in saveTo... feature, but custom save function. Is this a problem, or not?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo doesn't set dirty flag
Reply #1 - Sep 14th, 2009 at 2:05pm
Print Post  
Well, there are the ActionUndone and ActionRedone events, so you could set it to true from their handlers Wink It's not a problem to clear the Dirty flag from your custom function.

Stoyan
  
Back to top
 
IP Logged
 
Necroman
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 49
Joined: Jul 27th, 2009
Re: Undo doesn't set dirty flag
Reply #2 - Sep 14th, 2009 at 2:10pm
Print Post  
Stoyo wrote on Sep 14th, 2009 at 2:05pm:
Well, there are the ActionUndone and ActionRedone events, so you could set it to true from their handlers Wink It's not a problem to clear the Dirty flag from your custom function.

Stoyan

I already use that methods as a workaround and it works fine.
  
Back to top
 
IP Logged
 
Necroman
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 49
Joined: Jul 27th, 2009
Re: Undo doesn't set dirty flag
Reply #3 - Sep 16th, 2009 at 10:37am
Print Post  
Another question, I use composite commands on large block of code, but sometimes nothing is done in these blocks due to some restrictions and the created composite command is empty.
How to handle empty composite commands, so they will not occupy space in undo history? I guessed, that empty composite commands are omitted in history when calling execute, but that's not true. Also manually deleting items from undo history is not possible. I've also tried merging undo commands, but if there's only one empty command using merge is not possible.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo doesn't set dirty flag
Reply #4 - Sep 16th, 2009 at 12:27pm
Print Post  
I suppose you could handle that using the ActionRecording event. It is a validation event that lets you filter actions so that they are not recorded in the history.
  
Back to top
 
IP Logged
 
Necroman
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 49
Joined: Jul 27th, 2009
Re: Undo doesn't set dirty flag
Reply #5 - Sep 16th, 2009 at 1:21pm
Print Post  
ActionRecording works, thanks.

But another issue is here:
if I start the composite command and then I modify one tableNode in this way
Code
Select All
node.DeleteRow(pos);
node.InsertRow(row);
node[0, row].Image = someimage;
node[0, row].ImageAlign = ImageAlign.Center;
node[1, row].Text = somestring;
node[1, row].Tag = sometag;
node[1, row].ToolTip = somestring; 


Then calling undo causes, that the node loses it's treelike hierarchy - it became flat ???.
And then, if I call Redo, the created row is recreated, but it's empty.
Maybe some actions are not recorded into Undo, but is there an easy way, how to fix it?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Undo doesn't set dirty flag
Reply #6 - Sep 16th, 2009 at 3:44pm
Print Post  
Property assignments are not recorded automatically, otherwise we'd need to create an undo record for each assignment. You must enclose them within a ChangeItemCmd / Execute.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint