Image Wells

Isn’t that Obj-C? Would I have to rewrite it all in ASOC?

Hang on. Is this all because of ASOC or is there even no way of doing this in Obj-C?

Also what is the value path binding for an image well?

In would be interested but I guess it’s too much for ASOC, thanks for the help this post.

It turns out that it’s not very hard, either. First, you need to make your image well editable. Then you need to subclass it: File → New File, where it says “NSObject”, change it to “NSImageView”, and then change the class of your image well to the new class.

Then there’s no need to register or include a draggingEntered_ handler – you just need a performDragOperation_ handler. So if you had a text field that you wanted to contain the path to the image, you could use:

	property parent : class "NSImageView" -- subclass NSImageView
	property textField : missing value -- connected to a text field/label
	
	on performDragOperation_(sender)
		-- Get the file path
		set pb to sender's draggingPasteboard()
		set theFiles to pb's propertyListForType_("NSFilenamesPboardType")
		set filePath to item 1 of (theFiles as list)
		-- Set text field to path
		my textField's setStringValue_(filePath)
		return true -- otherwise it doesn't happen
	end performDragOperation_