Posted 20 years ago by Jeff Key
Avatar
Would it be possible to internally reset the Modified property when the document is saved? The current behavior is inconsistent with how most text editors work. I've tried setting it manually, but it doesn't seem to stick. This is the behavior I'm seeing:

1) Create/Load document
2) Type some text; enough so that a single undo won't undo everything <DocumentModifiedChanged fires - Modified == true>
3) Save
4) Set DocumentModified to false <DocumentModifiedChanged fires - Modified == false >
5) Undo once <DocumentModifiedChanged fires - Modified == true>
6) Undo until you've undone everything. <DocumentModifiedChanged fires - Modified == false>

It looks like it's tracking to the state of the last Text = <string>, not when Modified was last set. It would seem that if Modified is settable that it would be the starting point for the Modified comparison. Modified should be true if text is added or undos are performed to a state prior to Modified bing set.

Does that make sense?

Thanks

Comments (3)

Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I see what you're saying. The problem is that we have some complicated code to see if the original text-setting operation is available on the undo stack. That way, when you undo all the way back to the beginning, the Modified flag can reset to false. If you add enough undo items so that they exceed the stack, the original modification is moved off of it and an internal flag indicates that the original modification can no longer be reached.

Via some extra code we might be able to add functionality like what you're suggesting. However any undos beyond a save point should set Modified back to false. VS.NET handles documents that way. It's almost like we need to have a Modified state on each DocumentModification object in the undo stacks. And have that control when the main flag gets set.


Actipro Software Support

Posted 19 years ago by Thane Plummer
Avatar
The Modified flag is not very useful for providing information to users. It seems to be tracking the undo/redo stack rather than giving the "expected" value. By "expected", I mean that I'm really only interested in whether or not the text has been modified since it was last saved. After all, saving the text requires an action on the users part, and the user should be able to know whether or not they need to re-save the document.

Look at it from the users point of view: the question the user needs answered is whether or not the file needs to be saved. "If I quit the app now, will I lose my changes or do I need to save the file?" It would be nice if the editor provided a mechanism to give this information to users.

It sounds like two flags are needed: one for the undo stack and one for the document.
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Really, the Modified flag should reset whenever you undo back to a modification in which you either set the Text property or set the Modified property to false, correct? That way we still keep one property but it works a little more accurately. Right now it pays attention to the Text property setting but not the Modified property setting. Would that work for you?


Actipro Software Support

The latest build of this product (v24.1.0) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.