Detecting if the contents of a NSImageView has changed

Hello again,

This time I’m looking desperately into the doc to fine how the application can detect that the image() into a NSImageView instance has been changed, no matter how (drag & drop, cut & paste, or double-clicked bringing up an Open Dialog…).

A possibility that I found is to add an “observer” to the NSImageView, but is there a more simple way (or maybe the observer IS the simplest way?)

Thanks for any suggestion.

You can just have an action handler that’s called by the image view – it will be called when a user drags a picture into it, and I think it also works for cut and paste. As for the open dialog, you can deal with that by calling the image view’s action handler from within the handler that takes care of the user response to the dialog.


Works like a charm!

And as I don’t rely on the notification, i can use the same handler for the text and for the image:

	on textDidChange_(aNotification)
		set gDirty to true

Once again, thanks a lot. I was sure it was, as usual, much simpler than I thought :slight_smile: