tellboy, I’m not sure why that command is even in the docs, but you’re right, it doesn’t work. An image view (a cocoa NSImageView) is a view, not a control, so technically speaking it doesn’t necessarily have to respond to action events. In my opinion, it should respond to mouse events (i.e. mousedown) but for whatever reason this has been disabled in ASS. I think the problem is not that the image view should respond to the clicked event, but rather that it should not be an option in IB and it should be removed from the documentation. Whether the mouse events should be enabled is another story.
A common workaround, is to place a button over the image view and use that to capture your events. Set the button to borderless, and size it the same as your image view, so that it covers it completely. Ultimately, you should be able to configure it so that the user never knows the button is there.
Using NSbutton class, you can create an image button of any size. It supports everything imageview does, plus mouse over and clicked. I wouldn’t use an image view for something that needs clicked.
Yes, but nsimageview can do some things that a button can not… otherwise you wouldn’t need image views at all. If the images that tellboy are using are anything but icons for controls or ui elements, chances are he’ll need more flexibility in his image views than an nsbutton can provide. The major drawback to using a button instead of an image view is that a button does not have resizing or scaling capabilities. The button can only (by default) display the image as it is read straight from file. When working with images, it is often more practical to use nsimageview and then accomodate any shortcomings that the class has by either overriding them in a custom subclass, or using a button positioned over it to add functionality.
jobu is correct in that I need the in built scaling properties of an Image View which in my case is holding images approx. 750 x 550.
The purpose of trying to use the mouse click event was to break out of a loop which displays successive images.
I have previously tried the trick of allocating an escape key to an offscreen button and testing through an idle handler. This works to a point, however, if there is a delay of say 3 seconds between changing the image in the image view then it is necessary to hold the key down for this period otherwise it does not register. I am assuming the idle handler is not called when the delay command is in progress.
Another solution maybe to have a customised delay where the idle handler can be called but I’m not sure how to implement this.