Kyle
Kyle

Reputation: 17687

NSDocument - how to prevent a document from being marked as updated automatically?

I have a cocoa app that allows the user to enter a query. I'm using an NSWebView with a TextArea HTML object. The problem is, as soon as I type anything into the textarea, my document gets marked as updated. Does anyone know of a way to prevent this?

I've verified that using a NSTextField does not reproduce this behaviour, but I specifically want to go with the HTML/TextArea for styling.

So basically: Can I make it so an NSDocument does not get marked as edited unless I manually call:

[document updateChangeCount: NSChangeDone];

Upvotes: 2

Views: 328

Answers (1)

trojanfoe
trojanfoe

Reputation: 122401

This post on the Apple mailing list seems to match your problem exactly.

The solution suggested is to set a custom undo manager to the webview (sounds like hard work), however a quick-and-dirty hack looks to me like subclassing updateChangeCount and perverting things to your way of thinking.

Upvotes: 1

Related Questions