Matt Gemmell

TOLL is available now!

An action-thriller novel — book 2 in the KESTREL series.

★★★★★ — Amazon

Cocoa PopUpImage class coming soon

source 1 min read

For the last couple of days (on and off) I’ve been working on PopUpImage, a new NSButton subclass which provides a popup menu much like NSPopUpButton, but with a customisable pop-up arrow image (or whatever).

It properly highlights and dims itself when activated/disabled, it receives the keyboard focus (with ring around the image’s contours), and pops its menu on click, left-arrow, right-arrow or space. You can also set whether or not it indicates the selected item (i.e. whether or not it uses a check-mark beside the last selected item; it always keeps track of the selected item regardless).

You can set whether or not it pops its menu when you click on the main icon part of it (not just when you click on the popup arrow-image part), and you can set whether it displays the icon of the last selected item, or always just shows its default icon. It also auto-sizes itself to accommodate your images when you initialise it.

So there you have it. I’ll release it within the next few days; it will be open-source, of course. Here’s a screenshot of the class in action, and here’s another.

Must sleep now.