Icon in Combobox?

How can I add an icon to a combobox? As done in the OS X “Save” dialog, except I need it to work on both Mac & Windows.

Listbox has the RowPicture property but there’s no such property on a Combobox.

Thanks in advance!

[quote=267811:@Christian Wheel]How can I add an icon to a combobox? As done in the OS X “Save” dialog, except I need it to work on both Mac & Windows.

Listbox has the RowPicture property but there’s no such property on a Combobox.

Thanks in advance![/quote]

What you show is a PopupMenu. ComboBox has text editable like a TextField.

You best bet is to use an Emoji.

me.addrow(&u1F4C1+" Downloads") me.listindex = 0

http://unicode.org/emoji/charts/full-emoji-list.html

[quote=267813:@Michel Bujardet]What you show is a PopupMenu. ComboBox has text editable like a TextField.

You best bet is to use an Emoji.

me.addrow(&u1F4C1+" Downloads") me.listindex = 0

http://unicode.org/emoji/charts/full-emoji-list.html[/quote]

Thanks for a creative suggestion!

This works on Mac, but not on Windows: http://i.imgur.com/dzfcJZj.jpg

I’d also like to use icons that aren’t in the emoji set.

You seem to be using Windows 7. The Segoa Color Emoji font needs to be installed. See http://www.istartedsomething.com/20120818/microsoft-backports-windows-8-emoji-for-segoe-ui-symbol-to-windows-7/

To use your own pictures, you may try to overlay a canvas over the PopupMenu. Not tested.

Thanks, is there a way to calculate the Row Height of the combobox item, or the point position to place the canvas?

On OS X, it’s not difficult. It’s part of the Retina Kit (http://www.ohanaware.com/retinakit/). As for Windows, I’m afraid I don’t know.

If you do want to use icons in a ComboBox, I believe this is possible via a NSAttributedString (again Mac only), but I’ve never tried it, so can’t be 100% sure.

Not that I know of.

The alternative to modifying the PopupMenu is to create your own control with a button and a ListBox.

@Sam Rowlands Thanks for the tip, I got a retinakit license as part of a bundle last year. I’ll check it out.