Image won't display

I have the following code in an ASOC script:

property parent : class "NSView"
	property NSImage : class "NSImage"
	property tile1 : missing value
	property myBox : missing value
	property myWindow : missing value
	
	on mouseDown_(theEvent)
		set myImage to NSImage's imageNamed_("B.tiff")
		set mouseLoc to (theEvent's locationInWindow()) as record
		myImage's drawAtPoint_fromRect_operation_fraction_(mouseLoc, {{0, 0}, {0, 0}}, 1, 1)
	end mouseDown_

When I click the mouse in the window, nothing appears to happen, but if I then move the mouse up to where the close and minimize icons are in the title bar, the images appear. I’m guessing that I need some kind of display or update method to make them appear, but I’ve tried several and so far no luck.

Hi,

to update a view call its setNeedsDisplay: method with parameter YES.

The usual way to catch custom events is to subclass NSView and override the respective mouse event(s) and do the drawing in the drawInRect: method